Removed old file #2
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-push-artifact: | |
environment: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v3" | |
- name: Docker meta | |
id: meta | |
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" | |
uses: docker/build-push-action@v6 | |
with: | |
context: "{{defaultContext}}" | |
load: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.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: | | |
docker compose -f docker-compose.testing.yml -f docker-compose.ci.yml up --abort-on-container-exit --exit-code-from activitypub | |
- 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" | |
uses: docker/build-push-action@v6 | |
with: | |
context: "{{defaultContext}}" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: "Auth with gcloud" | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }} | |
- name: "Deploy 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 |