-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.yml
More file actions
88 lines (74 loc) · 2.48 KB
/
release.yml
File metadata and controls
88 lines (74 loc) · 2.48 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
---
name: "Release"
on:
workflow_dispatch:
env:
python_version: "{{ cookiecutter.python_version }}"
defaults:
run:
shell: 'bash --noprofile --norc -Eeuo pipefail {0}'
jobs:
release:
name: Create Release
runs-on: ubuntu-24.04
permissions:
contents: write
outputs:
tag: ${{ "{{ steps.release.outputs.tag }}" }}
steps:
- name: Checkout the repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: 'false'
- name: Bootstrap repository
uses: ./.github/actions/bootstrap
with:
token: ${{ "{{ secrets.GITHUB_TOKEN }}" }}
python-version: ${{ "{{ env.python_version }}" }}
- name: Create release
id: release
env:
GH_TOKEN: ${{ "{{ secrets.GITHUB_TOKEN }}" }}
run: |
# Configure git
git config user.name "{{ cookiecutter.company_name }} Automation"
git config user.email "automation@{{ cookiecutter.company_domain }}"
# Run semantic-release (auto-determines version from conventional commits)
task -v release
# Get the new tag
TAG=$(git describe --tags --abbrev=0)
echo "tag=${TAG}" | tee -a "${GITHUB_OUTPUT}"
echo "Created release tag: ${TAG}"
{%- if cookiecutter.dockerhub == 'yes' %}
publish-docker:
name: Publish Docker Image
needs: release
runs-on: ubuntu-24.04
steps:
- name: Checkout the repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ "{{ needs.release.outputs.tag }}" }}
persist-credentials: 'false'
- name: Bootstrap repository
uses: ./.github/actions/bootstrap
with:
token: ${{ "{{ secrets.GITHUB_TOKEN }}" }}
python-version: ${{ "{{ env.python_version }}" }}
- name: Set up QEMU for cross-platform emulation
uses: docker/setup-qemu-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ "{{ secrets.DOCKERHUB_USERNAME }}" }}
password: ${{ "{{ secrets.DOCKERHUB_PAT }}" }}
- name: Build and publish multiplatform Docker image
run: |
# Extract version from tag (remove 'v' prefix if present)
VERSION="${{ "{{ needs.release.outputs.tag }}" }}"
VERSION="${VERSION#v}"
# Build and push multiplatform image
task -v publish VERSION="${VERSION}" PLATFORM=all
{%- endif %}