chore: add permissions #1
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 & Publish to Registry | ||
on: | ||
workflow_call: | ||
inputs: | ||
### Values from CICD Workflow ### | ||
REGISTRY: | ||
required: true | ||
type: string | ||
description: 'The Environemnt which should be used.' | ||
ORGANISATION_NAME: | ||
type: string | ||
required: true | ||
description: 'The Subscription ID which should be used.' | ||
env: | ||
IMAGE: '${{ inputs.REGISTRY }}/${{ inputs.ORGANISATION_NAME }}/gh-runner' | ||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/[email protected] | ||
- name: Login to GitHub Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ inputs.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: | | ||
${{ env.IMAGE }} | ||
tags: | | ||
type=raw,latest | ||
type=sha,prefix=,suffix=,short=true | ||
- name: Build and push the fred version of the WebApp | ||
uses: docker/[email protected] | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
platforms: linux/amd64 | ||
push: true | ||
context: ./gh-runner | ||
file: ./gh-runner/Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
- name: Display image tag in summary | ||
run: | | ||
echo "### Build & release! :rocket:" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "Released image:" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "- ${{steps.meta.outputs.tags}}" >> $GITHUB_STEP_SUMMARY |