Merge pull request #104 from grassrootseconomics/philip/sms-address #22
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: release | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
DOCKER_IMAGE_NAME: cic-ussd | |
DOCKER_DESCRIPTION: A ussd client implementation that interfaces with the community inclusion currencies custodial system. | |
IMAGE_TAG: ghcr.io/grassrootseconomics/cic-ussd/cic-ussd | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- 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: Authenticate with Docker registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set outputs | |
run: | | |
echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV \ | |
&& echo "RELEASE_SHORT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build Docker image | |
run: | | |
docker buildx build \ | |
--progress plain \ | |
--tag ${{ env.IMAGE_TAG }}:${{ env.RELEASE_TAG }} \ | |
--tag ${{ env.IMAGE_TAG }}:latest \ | |
--cache-from type=local,src=/tmp/.buildx-cache \ | |
--cache-to type=local,dest=/tmp/.buildx-cache \ | |
--push . | |
- name: Tag Docker image with version | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: false | |
tags: ${{ env.IMAGE_TAG }}:${{ env.RELEASE_TAG }} | |
labels: | | |
org.opencontainers.image.title=${{ env.DOCKER_IMAGE_NAME }} | |
org.opencontainers.image.description=${{ env.DOCKER_DESCRIPTION }} | |
org.opencontainers.image.version=${{ env.RELEASE_TAG }} | |
- name: Push Docker image with version tag | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.IMAGE_TAG }}:${{ env.RELEASE_TAG }} | |
labels: | | |
org.opencontainers.image.title=${{ env.DOCKER_IMAGE_NAME }} | |
org.opencontainers.image.description=${{ env.DOCKER_DESCRIPTION }} | |
org.opencontainers.image.version=${{ env.RELEASE_TAG }} | |
- name: Push Docker image with latest tag | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.IMAGE_TAG }}:latest | |
labels: | | |
org.opencontainers.image.title=${{ env.DOCKER_IMAGE_NAME }} | |
org.opencontainers.image.description=${{ env.DOCKER_DESCRIPTION }} | |
org.opencontainers.image.version=latest |