Update actions/checkout action to v4 #455
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 Publish Image | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: none | |
checks: none | |
contents: none | |
deployments: none | |
issues: none | |
packages: write | |
pull-requests: none | |
repository-projects: none | |
security-events: none | |
statuses: none | |
id-token: none | |
steps: | |
- uses: actions/[email protected] | |
- name: Login to GitHub | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: docker_meta | |
uses: docker/[email protected] | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
flavor: | | |
latest=true | |
tags: | | |
type=sha,format=long | |
type=edge,branch=$repo.default_branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: push | |
uses: docker/[email protected] | |
with: | |
# platforms: linux/arm64,linux/amd64 | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
push: ${{ github.event_name != 'pull_request' }} | |
outputs: | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
sign: | |
if: github.event_name != 'pull_request' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
actions: none | |
checks: none | |
contents: none | |
deployments: none | |
issues: none | |
packages: write | |
pull-requests: none | |
repository-projects: none | |
security-events: none | |
statuses: none | |
id-token: write | |
steps: | |
- name: Login to GitHub | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: sigstore/[email protected] | |
- name: Sign the images | |
run: cosign sign ${TAGS} | |
env: | |
TAGS: ${{needs.build.outputs.tags}} | |
COSIGN_EXPERIMENTAL: 1 |