diff --git a/.github/workflows/server-prod.yaml b/.github/workflows/server-prod.yaml index 871a6cd3..d5b44416 100644 --- a/.github/workflows/server-prod.yaml +++ b/.github/workflows/server-prod.yaml @@ -4,49 +4,22 @@ on: tags: - '*' jobs: - release: - runs-on: ubuntu-latest + build-server: + uses: factly/gopie-ee/.github/workflows/docker-build-push.yaml@develop + with: + tags: asia-south1-docker.pkg.dev/factly-prod/gopie/server:${{ github.ref_name }} + context: server + dockerfile: server/Dockerfile permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - name: Set env - run: | - if [[ $GITHUB_REF == refs/tags/* ]]; then - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - elif [[ $GITHUB_EVENT_NAME == "release" ]]; then - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - else - echo "RELEASE_VERSION=latest" >> $GITHUB_ENV - fi - - name: Use Go - uses: actions/setup-go@v2 - id: setup_go - with: - go-version: "1.22.6" - - name: Cache go-modules - uses: actions/cache@v4 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push Gopie Server to Docker Hub - uses: docker/build-push-action@v4 - with: - push: true - tags: factly/gopie-server:${{ env.RELEASE_VERSION }} - file: server/Dockerfile - context: server - - - name: Build and push Gopie migration to Docker Hub - uses: docker/build-push-action@v4 - with: - push: true - tags: factly/gopie-migrate:${{ env.RELEASE_VERSION }} - file: server/Dockerfile.migrate - context: server \ No newline at end of file + contents: read + id-token: write + + build-migrate: + uses: factly/gopie-ee/.github/workflows/docker-build-push.yaml@develop + with: + tags: asia-south1-docker.pkg.dev/factly-prod/gopie/migrate:${{ github.ref_name }} + context: server + dockerfile: server/Dockerfile.migrate + permissions: + contents: read + id-token: write diff --git a/.github/workflows/web-app.yaml b/.github/workflows/web-app.yaml index 5b519827..b1d3eed3 100644 --- a/.github/workflows/web-app.yaml +++ b/.github/workflows/web-app.yaml @@ -6,28 +6,11 @@ on: jobs: release: - runs-on: ubuntu-latest + uses: factly/gopie-ee/.github/workflows/docker-build-push.yaml@develop + with: + tags: asia-south1-docker.pkg.dev/factly-prod/gopie/web:${{ github.ref_name }} + context: web + dockerfile: web/Dockerfile.prod permissions: - contents: 'read' - steps: - - uses: actions/checkout@v3 - - name: Set env - run: | - if [[ $GITHUB_REF == refs/tags/* ]]; then - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - else - echo "RELEASE_VERSION=latest" >> $GITHUB_ENV - fi - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push Gopie Web App Docker image to Docker Hub - uses: docker/build-push-action@v4 - with: - push: true - tags: factly/gopie-web:${{ env.RELEASE_VERSION }} - context: web - file: web/Dockerfile.prod + contents: read + id-token: write