feat: add test infrastructure for the web UI (#81) #145
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 and push docker image | |
on: | |
push: | |
paths: | |
- "**.go" | |
- "go.mod" | |
- "go.sum" | |
- "ui/**" | |
- "Dockerfile" | |
workflow_dispatch: | |
jobs: | |
docker: | |
permissions: | |
packages: write | |
contents: write | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build docker image | |
uses: docker/build-push-action@v6 | |
with: | |
load: true | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker registry | |
uses: docker/login-action@v3 | |
if: ${{ github.ref_name == 'main' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ github.ref_name == 'main' }} | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push docker image | |
uses: docker/build-push-action@v6 | |
if: ${{ github.ref_name == 'main' && steps.release.outputs.new_release_published == 'true' }} | |
with: | |
push: true | |
tags: | | |
${{ vars.DOCKERHUB_USERNAME }}/swarm-cd:latest | |
${{ vars.DOCKERHUB_USERNAME }}/swarm-cd:${{ steps.release.outputs.new_release_version }} | |
ghcr.io/${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:${{ steps.release.outputs.new_release_version }} | |
- name: Update Docker Hub repo description | |
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 | |
if: ${{ github.ref_name == 'main' && steps.release.outputs.new_release_published == 'true' }} | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: ${{ vars.DOCKERHUB_USERNAME }}/swarm-cd |