Merge pull request #49 from thibaultmg/upgrade_deps #7
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: Container build & push jobs | |
on: | |
push: | |
branches: | |
- master | |
- main | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+*" | |
jobs: | |
build_push_container: | |
runs-on: ubuntu-latest | |
name: Build and push the container image for a commit or tag. | |
steps: | |
- name: Checkout code into the Go module directory. | |
uses: actions/checkout@v3 | |
- name: Login to image registry | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache for Docker's buildx | |
uses: actions/cache@v3 | |
with: | |
path: .buildxcache/ | |
key: ${{ runner.os }}-buildx-${{ hashFiles('**/*.go', 'Dockerfile', 'go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Snapshot container buid & push | |
run: make conditional-container-build-push | |
- name: Check semver tag | |
id: check-semver-tag | |
# The regex below comes from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string. | |
run: | | |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ ]]; then | |
echo ::set-output name=match::true | |
fi | |
- name: Release container build & push | |
if: steps.check-semver-tag.outputs.match == 'true' | |
run: make container-release-build-push |