fix docker push permissions #206
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: {} | |
concurrency: | |
group: ${{ format('{0}/{1}', github.repository_owner, github.ref) }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the source code | |
uses: actions/checkout@v4 | |
- name: Run the custom linter | |
run: ./lint.sh | |
build: | |
name: Build images | |
runs-on: ubuntu-latest | |
needs: [lint] | |
# Use the same job to build all Linux-based images | |
strategy: | |
matrix: | |
image: | |
- linux | |
- linux-micro | |
steps: | |
- name: Checkout the source code | |
uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: docker build -t ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest ${{ matrix.image }}/ | |
- name: Authenticate with GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
- name: Upload the Docker image to GitHub Container Registry | |
run: docker push ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/master' |