diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5c5c00c..8c630056 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,15 +7,15 @@ env: IMAGE_NAME: europe-west4-docker.pkg.dev/ghost-activitypub/main/test-image jobs: - build-push-artifact: + build-test-deploy: environment: build runs-on: ubuntu-latest steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: actions/checkout@v3 - - name: Docker meta - id: meta + - name: ActivityPub Docker meta + id: apmeta uses: docker/metadata-action@v5 with: images: | @@ -27,47 +27,83 @@ jobs: type=semver,pattern={{major}} type=sha,priority=1100 - - name: "Build docker image" + - name: "Build Docker Image for ActivityPub" uses: docker/build-push-action@v6 with: context: "{{defaultContext}}" load: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.apmeta.outputs.tags }} + labels: ${{ steps.apmeta.outputs.labels }} - - name: "Create ci docker compose file" + - name: "Create CI Docker Compose File" run: | echo " services: activitypub: image: $IMAGE_NAME:$DOCKER_METADATA_OUTPUT_VERSION" > docker-compose.ci.yml - - name: "Run tests" + - name: "Run Tests" run: yarn test - - name: Login to GAR + - name: Migrations Docker meta + id: migrationmeta + uses: docker/metadata-action@v5 + with: + images: | + europe-west4-docker.pkg.dev/ghost-activitypub/main/migrations + tags: | + type=edge,branch=main + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha,priority=1100 + + - name: "Build Docker Image for Migrations" + uses: docker/build-push-action@v6 + with: + context: migrate + load: true + tags: ${{ steps.migrationmeta.outputs.tags }} + labels: ${{ steps.migrationmeta.outputs.labels }} + + - name: "Login to GAR" uses: docker/login-action@v3 with: registry: europe-west4-docker.pkg.dev username: _json_key password: ${{ secrets.SERVICE_ACCOUNT_KEY }} - - name: "Push docker image" + # - name: "Push ActivityPub Docker Image" + # uses: docker/build-push-action@v6 + # with: + # context: "{{defaultContext}}" + # push: true + # tags: ${{ steps.apmeta.outputs.tags }} + # labels: ${{ steps.apmeta.outputs.labels }} + + - name: "Push Migrations Docker Image" uses: docker/build-push-action@v6 with: - context: "{{defaultContext}}" + context: migrate push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.migrationmeta.outputs.tags }} + labels: ${{ steps.migrationmeta.outputs.labels }} - - name: "Auth with gcloud" + - name: "Auth with Google Cloud" uses: 'google-github-actions/auth@v2' with: credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }} - - name: "Deploy to Cloud Run" + - name: "Deploy Migrations to Cloud Run" uses: 'google-github-actions/deploy-cloudrun@v2' with: - image: europe-west4-docker.pkg.dev/ghost-activitypub/main/test-image:edge + image: europe-west4-docker.pkg.dev/ghost-activitypub/main/migrations:edge region: europe-west4 - service: activitypub + service: migrations + + # - name: "Deploy ActivityPub to Cloud Run" + # uses: 'google-github-actions/deploy-cloudrun@v2' + # with: + # image: europe-west4-docker.pkg.dev/ghost-activitypub/main/test-image:edge + # region: europe-west4 + # service: activitypub