Container Build #5
This file contains hidden or 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: "Container Build" | |
| on: | |
| workflow_dispatch: # needed for manually running this workflow | |
| schedule: | |
| - cron: "15 3 * * *" # sadly there is no TZ support here | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # checkout code: | |
| - uses: actions/checkout@v3 | |
| # create json file with credentials for github container registry: | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # ugly workaround for converting content of $GITHUB_REPOSITORY (= `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`) | |
| # to lowercase which is needed for using as image name | |
| - name: downcase GITHUB_REPOSITORY | |
| run: | | |
| echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}" | |
| # build container image with kaniko: | |
| - uses: int128/kaniko-action@v1 | |
| with: | |
| file: container/Dockerfile | |
| push: true | |
| tags: ghcr.io/${{ env.REPO }}:${{ github.ref_name }} | |
| labels: GITREF=${{ github.sha }} | |
| build-args: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} |