Skip to content

Commit

Permalink
Merge pull request #30 from musicEnfanthen/update-workflow
Browse files Browse the repository at this point in the history
ci(gh-actions): harden actions
  • Loading branch information
bwbohl authored Jun 25, 2024
2 parents 2ba6c6c + 37c5a01 commit dcfd5c4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
labels:
- 'gh actions dependencies'

- package-ecosystem: docker
directory: /
schedule:
interval: daily
labels:
- 'dependencies'

- package-ecosystem: npm
directory: /
schedule:
interval: daily
labels:
- 'dependencies'
22 changes: 16 additions & 6 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
paths-ignore:
- '**.md' # ignore changes in markdown files

permissions:
contents: read

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -18,35 +21,42 @@ jobs:
build-and-push-image:
runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'music-encoding' }}

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

- name: Login to GitHub Container Registry
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v2
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: MAIN – Build and push
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

- name: PR – build only
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: .
file: Dockerfile
Expand Down

0 comments on commit dcfd5c4

Please sign in to comment.