on: push: tags: - "v*" name: Test and Release permissions: contents: read jobs: test: uses: ./.github/workflows/_tests.yml with: release-certs: true skip-staticcheck: true secrets: TTL_KEY: ${{ secrets.TTL_KEY }} TTL_CERT: ${{ secrets.TTL_CERT }} buildx: needs: [test] name: Release runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0 - name: Login to DockerHub uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Log in to the Container registry uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Docker meta id: meta uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: | amir20/dozzle ghcr.io/amir20/dozzle flavor: | latest=false tags: | type=raw,value=latest type=semver,pattern={{version}},prefix=v type=semver,pattern={{major}}.{{minor}},prefix=v type=semver,pattern={{major}},prefix=v - name: Docker meta for alpine variant id: meta-alpine uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: | amir20/dozzle ghcr.io/amir20/dozzle # Without this, latest=auto adds a bare `latest` tag on semver pushes # and the alpine build (which runs second) overwrites the real latest. flavor: | latest=false tags: | type=raw,value=alpine type=semver,pattern={{version}},prefix=v,suffix=-alpine type=semver,pattern={{major}}.{{minor}},prefix=v,suffix=-alpine type=semver,pattern={{major}},prefix=v,suffix=-alpine - name: Writing certs to file run: | echo "${{ secrets.TTL_KEY }}" > shared_key.pem echo "${{ secrets.TTL_CERT }}" > shared_cert.pem - name: Build and push uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: push: true sbom: true context: . platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 tags: ${{ steps.meta.outputs.tags }} build-args: TAG=${{ steps.meta.outputs.version }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Build and push alpine variant uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: push: true sbom: true context: . target: alpine platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 tags: ${{ steps.meta-alpine.outputs.tags }} build-args: TAG=${{ steps.meta.outputs.version }} labels: ${{ steps.meta-alpine.outputs.labels }} # No cache-to. This shares every stage up to the builder with the step # above, which already exported them, and the alpine stage itself is # three COPYs. Exporting again would only overwrite that step's index. cache-from: type=gha git-release: needs: [buildx] name: Github Release runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Install Node uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 - name: Release to Github env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx changelogithub