Initial attempt at migration workflow #270
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test, Build and Push to Artifact Registry | |
on: | |
push: | |
env: | |
IMAGE_NAME: europe-west4-docker.pkg.dev/ghost-activitypub/main/test-image | |
jobs: | |
build-test-deploy: | |
environment: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: ActivityPub Docker meta | |
id: apmeta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
europe-west4-docker.pkg.dev/ghost-activitypub/main/test-image | |
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 ActivityPub" | |
uses: docker/build-push-action@v6 | |
with: | |
context: "{{defaultContext}}" | |
load: true | |
tags: ${{ steps.apmeta.outputs.tags }} | |
labels: ${{ steps.apmeta.outputs.labels }} | |
- name: "Create CI Docker Compose File" | |
run: | | |
echo " | |
services: | |
activitypub: | |
image: $IMAGE_NAME:$DOCKER_METADATA_OUTPUT_VERSION" > docker-compose.ci.yml | |
- name: "Run Tests" | |
run: yarn test | |
- 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 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: migrate | |
push: true | |
tags: ${{ steps.migrationmeta.outputs.tags }} | |
labels: ${{ steps.migrationmeta.outputs.labels }} | |
- name: "Auth with Google Cloud" | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }} | |
- name: "Deploy Migrations to Cloud Run" | |
uses: 'google-github-actions/deploy-cloudrun@v2' | |
with: | |
image: europe-west4-docker.pkg.dev/ghost-activitypub/main/migrations:edge | |
region: europe-west4 | |
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 |