Skip to content

Commit d7f0abd

Browse files
committed
update release workflow to create a github release on push to tag
1 parent 35a28f6 commit d7f0abd

3 files changed

Lines changed: 20 additions & 77 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- master
77
pull_request:
8-
branches:
8+
branches:
99
- master
1010

1111
jobs:

.github/workflows/release.yml

Lines changed: 13 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,21 @@
11
name: Release
22

33
on:
4-
workflow_call:
5-
inputs:
6-
tag_name:
7-
required: true
8-
type: string
9-
wheel_file:
10-
required: true
11-
type: string
12-
secrets:
13-
pypi_token:
14-
required: true
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
1511
jobs:
1612
release:
13+
name: Release
1714
runs-on: ubuntu-latest
18-
env:
19-
tag_name: ${{ inputs.tag_name }}
20-
wheel_file: ${{ inputs.wheel_file }}
2115
steps:
22-
- uses: actions/checkout@v3
23-
with:
24-
fetch-depth: 0
25-
26-
- name: Make a tag and create CHANGELOG.md
27-
run: |
28-
previous_tag=$(git -c 'versionsort.suffix=-' \
29-
ls-remote --exit-code --refs --sort='version:refname' --tags origin '*.*.*' \
30-
| tail --lines=1 \
31-
| cut -d '/' -f 3)
32-
echo "Tag $tag_name" will be created
33-
git config user.name "GitHub Actions Bot"
34-
git config user.email "<>"
35-
git tag -a $tag_name -m "Updated by Github workflow"
36-
37-
echo "Change Log" > CHANGELOG.md
38-
echo "-----------------" >> CHANGELOG.md
39-
echo "All the commits since the last tag are as follows:" >> CHANGELOG.md
40-
git log --pretty=oneline $previous_tag...$tag_name >> CHANGELOG.md
41-
git push origin $tag_name
42-
43-
44-
- name: Download dist artifact
45-
uses: actions/download-artifact@v3
46-
with:
47-
name: ${{ inputs.wheel_file }}
48-
49-
- name: Place artifacts
50-
run: |
51-
mkdir dist/
52-
mv $wheel_file dist/$wheel_file
53-
54-
# loads contents of the dist/ folder into PyPI
55-
- name: Publish distribution 📦 to PyPI
56-
uses: pypa/gh-action-pypi-publish@release/v1
57-
with:
58-
user: __token__
59-
password: ${{ secrets.pypi_token }}
60-
verbose: true
61-
62-
- name: Create Github Release
63-
id: create-release
64-
uses: actions/create-release@v1
16+
- name: Create release
6517
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
with:
68-
tag_name: ${{ inputs.tag_name }}
69-
release_name: Release ${{ inputs.tag_name }}
70-
draft: false
71-
prerelease: false
72-
body_path: ./CHANGELOG.md
73-
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
TAG: ${{ github.ref_name }}
20+
run: |
21+
gh release create "$TAG" --repo="$GITHUB_REPOSITORY" --title "release $TAG" --notes "release $TAG" --target $TAG

.github/workflows/test-and-build.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
description: "wheel file name"
1515
value: ${{ jobs.test-and-build.outputs.wheel_file }}
1616
env:
17-
PIPELINE_POETRY: '1.4.0'
17+
PIPELINE_POETRY: '1.4.0'
1818

1919
jobs:
2020
test-and-build:
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v3
2828
- name: Set up Python 3.11
29-
uses: actions/setup-python@v4
29+
uses: actions/setup-python@v4
3030
with:
3131
python-version: '3.11'
3232
- name: Poetry Installation and configure
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Install dependencies
4444
run: |
45-
poetry install
45+
poetry install
4646
4747
- name: Run pytests
4848
run: |
@@ -55,8 +55,8 @@ jobs:
5555
cv aggregate test/aggregate_example.toml \
5656
cvcreator/templates/example.toml \
5757
cvcreator/templates/example.toml
58-
python -m cvcreator --latex cvcreator/templates/example.toml output.tex
59-
58+
python -m cvcreator --latex cvcreator/templates/example.toml output.tex
59+
6060
- name: Check Package Release
6161
id: pkg-version
6262
run: |
@@ -73,7 +73,7 @@ jobs:
7373
echo "skip_release=YES" >> $GITHUB_OUTPUT
7474
fi
7575
76-
- name: Make a New Wheel file
76+
- name: Make a New Wheel file
7777
id: wheel
7878
if: ${{ steps.pkg-version.outputs.skip_release == 'NO' }}
7979
run: |
@@ -88,8 +88,3 @@ jobs:
8888
path: dist
8989
retention-days: 1
9090

91-
92-
93-
94-
95-

0 commit comments

Comments
 (0)