Improved actions #16
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: Publish docker container | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
env: | |
TEST_TAG: ${{ github.repository }}:test | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish to Docker Hub | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests | |
uses: ./.github/workflows/validate.yml | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
load: true | |
tags: ${{ env.TEST_TAG }} | |
- name: Get a free port | |
run: echo "PORT=$(scripts/get-free-port.sh)" >> $GITHUB_ENV | |
- name: Start the Docker container | |
run: docker run -d --rm --name test-container -p ${{ env.PORT }}:9229 ${{ env.TEST_TAG }} | |
- name: Test | |
run: scripts/smoke-test.sh | |
env: | |
PORT: ${{ env.PORT }} | |
- name: Stop the Docker container | |
run: docker stop test-container | |
- name: Load Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ github.repository }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=edge | |
- name: Push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |