make env ephemeral, update gitea #22
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: Build wacs Docker Image | |
on: | |
push: | |
paths: | |
- 'wacs-gitea/**' | |
- '.github/workflows/docker-build.yml' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
#build and publish image | |
Build-Image: | |
name: Build image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Build image with buildx | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./wacs-gitea | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
Push-Image: | |
name: Push images if this is a branch | |
runs-on: ubuntu-latest | |
needs: [Build-Image] | |
if: ${{ contains(fromJson('["push"]'), github.event_name) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: FranzDiebold/[email protected] | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Set docker tags | |
run: | | |
echo "TAG_SHA=wycliffeassociates/wacs:$GITHUB_SHA" >> $GITHUB_ENV && \ | |
echo "TAG_BRANCH=wycliffeassociates/wacs:$CI_REF_NAME_SLUG" >> $GITHUB_ENV && \ | |
echo "TAG_LATEST=wycliffeassociates/wacs:latest" >> $GITHUB_ENV | |
- name: Build and conditional push API image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./wacs-gitea | |
push: true | |
tags: | | |
${{ env.TAG_SHA }} | |
${{ env.TAG_BRANCH }} | |
${{ env.TAG_LATEST }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |