Skip to content

Commit 506bf53

Browse files
committed
ci: Add Release Workflow
workflow for building and publishing release assets
1 parent 9386069 commit 506bf53

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release Cally
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
test-cally:
10+
uses: ./.github/workflows/test-cally.yaml
11+
12+
build-artifact:
13+
runs-on: ubuntu-latest
14+
needs: test-cally
15+
outputs:
16+
version: ${{ steps.set-version.outputs.version }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set package version
20+
id: set-version
21+
run: echo "VERSION=$( echo $GITHUB_REF | sed 's/refs\/tags\/v//' )" >> $GITHUB_OUTPUT
22+
- name: Write version
23+
env:
24+
VERSION: ${{ steps.set-version.outputs.version }}
25+
run: |
26+
echo "VERSION: $VERSION"
27+
echo "VERSION = '$VERSION'" > src/cally/cli/_version.py
28+
- name: Setup Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.11"
32+
- name: Install build
33+
run: pip install build
34+
- name: Build distribution
35+
run: python -m build
36+
- name: Save dist files
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: package-${{ steps.set-version.outputs.version }}
40+
path: dist
41+
if-no-files-found: "error"
42+
43+
generate-pypi-release:
44+
runs-on: ubuntu-latest
45+
needs: build-artifact
46+
environment:
47+
name: pypi
48+
url: https://pypi.org/p/cally
49+
permissions:
50+
id-token: write
51+
steps:
52+
- name: Get distribution
53+
uses: actions/download-artifact@v3
54+
with:
55+
name: package-${{ needs.build-artifact.outputs.version }}
56+
path: dist
57+
- name: Publish
58+
uses: pypa/gh-action-pypi-publish@release/v1
59+
60+
generate-gh-release:
61+
runs-on: ubuntu-latest
62+
needs: build-artifact
63+
steps:
64+
- name: Get distribution
65+
uses: actions/download-artifact@v3
66+
with:
67+
name: package-${{ needs.build-artifact.outputs.version }}
68+
path: dist
69+
- uses: "marvinpinto/action-automatic-releases@latest"
70+
with:
71+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
72+
prerelease: false
73+
draft: false
74+
files: |
75+
dist/cally-${{ needs.build-artifact.outputs.version }}.tar.gz

.github/workflows/test-cally.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Test
22

33
on:
4+
workflow_call:
45
push:
56
branches-ignore:
67
- main

0 commit comments

Comments
 (0)