diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5f7f958 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +name: Create Release and Package + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build_and_push_backend: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push backend image + uses: docker/build-push-action@v5 + with: + context: ./eco_project/backend + file: ./eco_project/backend/Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/eco-backend:${{ github.ref_name }} + + build_and_push_frontend: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push frontend image + uses: docker/build-push-action@v5 + with: + context: . + file: ./eco_project/frontend/Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/eco-frontend:${{ github.ref_name }} + + create_release: + runs-on: ubuntu-latest + needs: [build_and_push_backend, build_and_push_frontend] + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + body: | + This release contains the Docker images for the backend and frontend. + draft: false + prerelease: false