-
Notifications
You must be signed in to change notification settings - Fork 47
105 lines (90 loc) · 3.26 KB
/
release.yml
File metadata and controls
105 lines (90 loc) · 3.26 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Release Action (automated)
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
concurrency:
group: release
jobs:
push-to-registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
# Check if the tests were successful and were launched by a push event
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ewjoachim
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.11.0
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- id: docker_meta
uses: docker/metadata-action@v5.7.0
with:
images: ghcr.io/${{ github.repository }}
tags: type=sha,format=long
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.build
platforms: linux/amd64,linux/arm64
labels: |
project='python-coverage-comment-action-base'
org='py-cov-action'
commit-sha='${{ github.sha }}'
org.opencontainers.image.source='https://github.com/${{ github.repository }}'
org.opencontainers.image.description='Publish coverage report as PR comment, and create a coverage badge & dashboard to display on the Readme for Python projects, all inside GitHub without third party servers'
org.opencontainers.image.licenses='MIT'
tags: |
ewjoachim/python-coverage-comment-action-base:v6
ghcr.io/py-cov-action/python-coverage-comment-action-base:v6
${{ steps.docker_meta.outputs.tags }}
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:latest
cache-from: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:latest
cache-to: type=inline
push: true
compute-tags:
name: Re-tag action with new version
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Apply new tags
env:
GH_TOKEN: ${{ github.token }}
run: |
set -eux
current="$(git describe --tags --abbrev=0 --match 'v*.*')"
major="$(echo $current | cut -d. -f1)"
minor="$(echo $current | cut -d. -f2)"
git tag -f ${major}
git push -f origin ${major}