diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 3039791..16e5412 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -27,16 +27,8 @@ { "fileMatch": ["^Dockerfile$"], "matchStrings": [ - "datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?\\sENV .*?_VERSION=(?.*)\\s" - ], - "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" - }, - { - "fileMatch": ["^Dockerfile$"], - "matchStrings": [ - "ARG IMAGE=(?.*?):(?.*?)@(?sha256:[a-f0-9]+)\\s" - ], - "datasourceTemplate": "docker" + "datasource=(?.*?) depName=(?.*?)\\sARG .*?_VERSION=(?v.*)\\s" + ] } ] } diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..a513be4 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,49 @@ +--- +name: Publish container + +on: + workflow_dispatch: {} + push: + tags: + - "*" + branches: + - main + paths: + - DOCKERFILE + - config/** + - scripts/** + +jobs: + build-push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login to ghcr + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Container meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=raw, value=latest, enable={{is_default_branch}} + type=semver, pattern={{version}} + type=ref, event=branch + type=ref, event=tag + type=ref, event=pr + + - name: Build and push to ghcr + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}