|
12 | 12 | branches: [ main, master ] |
13 | 13 | pull_request: |
14 | 14 | branches: [ main, master ] |
| 15 | + release: |
| 16 | + types: [ published ] |
15 | 17 |
|
16 | 18 | concurrency: |
17 | 19 | group: ${{ github.workflow }}-${{ github.ref }} |
|
38 | 40 | run: | |
39 | 41 | echo "PLATFORM_NAME=${{ matrix.platform }}" | sed 's|/|-|g' >> $GITHUB_ENV |
40 | 42 |
|
| 43 | + - name: Determine Docker tag |
| 44 | + id: docker-tag |
| 45 | + run: | |
| 46 | + if [ "${{ github.event_name }}" = "release" ]; then |
| 47 | + echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" |
| 48 | + else |
| 49 | + echo "tag=${{ github.event.inputs.tag || 'latest' }}" >> "$GITHUB_OUTPUT" |
| 50 | + fi |
| 51 | +
|
41 | 52 | - name: Checkout source code |
42 | 53 | uses: actions/checkout@v4 |
43 | 54 |
|
|
63 | 74 | images: ghcr.io/moontechlab/lunatv |
64 | 75 | tags: | |
65 | 76 | type=raw,value=${{ github.event.inputs.tag || 'latest' }},enable={{is_default_branch}} |
| 77 | + type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} |
| 78 | + type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} |
66 | 79 |
|
67 | 80 | - name: Build and push by digest |
68 | 81 | id: build |
|
72 | 85 | file: ./Dockerfile |
73 | 86 | platforms: ${{ matrix.platform }} |
74 | 87 | labels: ${{ steps.meta.outputs.labels }} |
75 | | - tags: ghcr.io/moontechlab/lunatv:${{ github.event.inputs.tag || 'latest' }} |
| 88 | + tags: ghcr.io/moontechlab/lunatv:${{ steps.docker-tag.outputs.tag }} |
76 | 89 | outputs: type=image,name=ghcr.io/moontechlab/lunatv,name-canonical=true,push=true |
77 | 90 |
|
78 | 91 | - name: Export digest |
@@ -115,10 +128,19 @@ jobs: |
115 | 128 | id: lowercase |
116 | 129 | run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" |
117 | 130 |
|
| 131 | + - name: Determine Docker tag |
| 132 | + id: docker-tag |
| 133 | + run: | |
| 134 | + if [ "${{ github.event_name }}" = "release" ]; then |
| 135 | + echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" |
| 136 | + else |
| 137 | + echo "tag=${{ github.event.inputs.tag || 'latest' }}" >> "$GITHUB_OUTPUT" |
| 138 | + fi |
| 139 | +
|
118 | 140 | - name: Create manifest list and push |
119 | 141 | working-directory: /tmp/digests |
120 | 142 | run: | |
121 | | - docker buildx imagetools create -t ghcr.io/moontechlab/lunatv:${{ github.event.inputs.tag || 'latest' }} \ |
| 143 | + docker buildx imagetools create -t ghcr.io/moontechlab/lunatv:${{ steps.docker-tag.outputs.tag }} \ |
122 | 144 | $(printf 'ghcr.io/moontechlab/lunatv@sha256:%s ' *) |
123 | 145 |
|
124 | 146 | cleanup-refresh: |
|
0 commit comments