Skip to content

Commit 19d70e6

Browse files
authored
added release.yml (#26)
1 parent 4349e24 commit 19d70e6

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: MIO Release Pipeline
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Read version from file
19+
id: version
20+
run: |
21+
VERSION=$(cat VERSION)
22+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
23+
24+
- name: Check if tag exists
25+
id: check_tag
26+
continue-on-error: true
27+
run: git rev-parse v${{ steps.version.outputs.VERSION }} >/dev/null 2>&1
28+
29+
- name: Create release tag
30+
if: steps.check_tag.outcome == 'failure'
31+
run: |
32+
git config user.name "github-actions"
33+
git config user.email "[email protected]"
34+
git tag -a v${{ steps.version.outputs.VERSION }} -m "Release ${{ steps.version.outputs.VERSION }}"
35+
git push origin v${{ steps.version.outputs.VERSION }}
36+
37+
- name: Create tar archive
38+
run: |
39+
tar -czf mio-${{ steps.version.outputs.VERSION }}.tar.gz \
40+
--exclude=.git \
41+
--exclude=.github \
42+
--exclude=build \
43+
--exclude=.gitignore \
44+
--exclude=.clang-format \
45+
--exclude=.clang-tidy \
46+
.
47+
48+
- name: Create GitHub Release
49+
if: steps.check_tag.outcome == 'failure'
50+
id: create_release
51+
uses: actions/create-release@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
tag_name: v${{ steps.version.outputs.VERSION }}
56+
release_name: Release ${{ steps.version.outputs.VERSION }}
57+
body: |
58+
Release of MIO ${{ steps.version.outputs.VERSION }}
59+
draft: false
60+
prerelease: false
61+
62+
- name: Upload tar archive to release
63+
if: steps.check_tag.outcome == 'failure'
64+
uses: actions/upload-release-asset@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
upload_url: ${{ steps.create_release.outputs.upload_url }}
69+
asset_path: ./mio-${{ steps.version.outputs.VERSION }}.tar.gz
70+
asset_name: mio-${{ steps.version.outputs.VERSION }}.tar.gz
71+
asset_content_type: application/gzip

0 commit comments

Comments
 (0)