Update dockerimage.yml #1093
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: Docker | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
workflow_dispatch: | ||
permissions: | ||
contents: write | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set IMAGE | ||
run: echo "IMAGE=${GITHUB_REPOSITORY#*/docker-}" >> "${GITHUB_ENV}" | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-qemu-action@v3 | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/metadata-action@v5 | ||
id: meta | ||
with: | ||
images: ${{ github.repository_owner }}/${{ env.IMAGE }} | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- uses: docker/login-action@v3 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ env.IMAGE }} | ||
platforms: linux/amd64,linux/arm64 | ||
pull: true | ||
push: ${{ github.event_name != 'pull_request' }} | ||
sbom: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Test the Docker image | ||
working-directory: ${{ env.IMAGE }} | ||
run: docker compose -f docker-compose.test.yml run sut | ||
- name: Set RELEASE | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
# shellcheck disable=SC2086 | ||
RC="$(\grep ${IMAGE}/Dockerfile -e '^FROM' | sed -e 's/^.*://')" | ||
if [[ "${RC}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && ! git show-ref --tags --verify --quiet "refs/tags/v${RC}" ; then | ||
echo "RELEASE=${RC}" >> "${GITHUB_ENV}" | ||
fi | ||
- name: Trigger release | ||
if: env.RELEASE = true | ||
Check failure on line 61 in .github/workflows/dockerimage.yml GitHub Actions / DockerInvalid workflow file
|
||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
with: | ||
tag_name: v${{ env.RELEASE }} |