2024-02-05 14:56:17 +01:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Check out repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
|
|
|
- name: Login to GHCR Docker registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2024-02-05 15:14:21 +01:00
|
|
|
|
|
|
|
- name: Set outputs
|
|
|
|
run: |
|
|
|
|
echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
|
2024-02-05 14:56:17 +01:00
|
|
|
- name: Build and push image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: ./
|
|
|
|
file: ./Dockerfile
|
|
|
|
platforms: linux/amd64
|
2024-02-05 15:14:21 +01:00
|
|
|
push: true
|
2024-02-05 14:56:17 +01:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
|
|
tags: |
|
|
|
|
ghcr.io/grassrootseconomics/farmstar-survey-backend/farmstar-survey-backend:latest
|
|
|
|
ghcr.io/grassrootseconomics/farmstar-survey-backend/farmstar-survey-backend:${{ env.RELEASE_TAG }}
|
2024-02-05 15:14:21 +01:00
|
|
|
|