-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.58 KB
/
publish-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Release image
on:
push:
branches:
- main
- renovate/**
pull_request:
permissions:
contents: read
packages: write
jobs:
get-versions:
name: Build and push image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract samba version
id: samba
run: |
echo "version=$(sed -nr 's/^ARG SAMBA_VERSION=(.*)$/\1/p' Dockerfile)" >> "$GITHUB_OUTPUT"
- name: Extract alpine version
id: alpine
run: |
echo "version=$(grep -oE 'alpine:([^ ]+)' Dockerfile | head -1 | cut -d: -f2)" >> "$GITHUB_OUTPUT"
- name: Generate tag
id: tag
run: |
echo "bare=v${{ steps.samba.outputs.version }}" >> "$GITHUB_OUTPUT"
echo "distro=v${{ steps.samba.outputs.version }}-alpine${{ steps.alpine.outputs.version }}" >> "$GITHUB_OUTPUT"
echo "full=v${{ steps.samba.outputs.version }}-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
outputs:
tags: |
ghcr.io/${{ github.repository_owner }}/samba-docker/samba:${{ steps.tag.outputs.bare }}
ghcr.io/${{ github.repository_owner }}/samba-docker/samba:${{ steps.tag.outputs.distro }}
ghcr.io/${{ github.repository_owner }}/samba-docker/samba:${{ steps.tag.outputs.full }}
release-image:
needs: [ get-versions ]
uses: txqueuelen/.github/.github/workflows/common-docker-releaser.yaml@main
with:
tags: ${{ needs.get-versions.outputs.tags }}
push: ${{ github.ref_name == github.event.repository.default_branch }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}