Skip to content

Commit 97bca13

Browse files
committed
added github release automation to workflow
1 parent b9f4bd7 commit 97bca13

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ jobs:
66
- uses: actions/checkout@v2
77
- name: Build packages for linux/arm64 platform
88
run: |
9-
9+
1010
# Enable an execution of different multi-architecture containers by QEMU
1111
sudo apt-get update -y
12-
sudo apt-get install -y qemu qemu-user-static
12+
sudo apt-get install -y qemu qemu-user-static
1313
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
1414
1515
# Build packages on aarch64 architecture
@@ -30,6 +30,7 @@ jobs:
3030
cp build/deb/*.deb /artifacts && \
3131
cp build/rpm/*.rpm /artifacts && \
3232
rm -rf build"
33+
3334
- name: Build packages for linux/amd64 platform
3435
run: |
3536
sudo apt-get install -y rpm
@@ -38,6 +39,7 @@ jobs:
3839
make rpm
3940
sudo cp build/deb/*.deb ${PWD}/artifacts
4041
sudo cp build/rpm/*.rpm ${PWD}/artifacts
42+
4143
- name: Deploy
4244
if: ${{ github.ref == 'refs/heads/main' }}
4345
run: |
@@ -55,3 +57,39 @@ jobs:
5557
done
5658
env:
5759
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
60+
61+
- name: Extract version from Makefile
62+
id: make_version
63+
run: |
64+
echo ::set-output name=version::$(make version)
65+
66+
- name: Create Tag
67+
uses: actions/github-script@v6
68+
with:
69+
github-token: ${{ github.token }}
70+
script: |
71+
try {
72+
await github.rest.git.updateRef({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
ref: "tags/v${{ steps.make_version.outputs.version }}",
76+
sha: context.sha,
77+
force: true
78+
})
79+
} catch (e) {
80+
await github.rest.git.createRef({
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
ref: "refs/tags/v${{ steps.make_version.outputs.version }}",
84+
sha: context.sha
85+
})
86+
}
87+
88+
- name: Create Release
89+
run: |
90+
curl \
91+
-X POST \
92+
-H "Accept: application/vnd.github+json" \
93+
-H "Authorization: token ${{ secrets.GH_RELEASE_TOKEN }}" \
94+
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases \
95+
-d '{"tag_name":"v${{ steps.make_version.outputs.version }}","target_commitish":"${{ github.sha }}","name":"v${{ steps.make_version.outputs.version }}","body":"${{ github.event.head_commit.message }}","draft":false,"prerelease":false,"generate_release_notes":false}'

0 commit comments

Comments
 (0)