Added permissions #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: release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: "Branch to release from ?" | ||
required: true | ||
default: "main" | ||
# release-version: | ||
# description: "Release version ?" | ||
# required: true | ||
# release-tag: | ||
# description: "Release tag ?" | ||
# required: true | ||
# development-version: | ||
# description: "Next Development version ?" | ||
# required: true | ||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permi ssions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
- name: Login to Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push image | ||
uses: docker/build-push-action@v4 | ||
id: push | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.IMAGE_NAME }}:${{ github.event.inputs.release-tag }},${{ env.IMAGE_NAME }}:latest | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true | ||
# - name: Create GitHub Release | ||
# id: create_release | ||
# uses: softprops/action-gh-release@v1 | ||
# with: | ||
# tag_name: ${{ github.event.inputs.release-tag }} | ||
# draft: false | ||
# prerelease: false | ||
# generate_release_notes: true | ||