Skip to content

Commit 3f264a5

Browse files
committed
ci: add a job to release
1 parent 902a7b9 commit 3f264a5

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

.github/workflows/linux.yml

+57
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,60 @@ jobs:
3434
path: |
3535
*.tar.*
3636
*.sum
37+
38+
# Release
39+
- name: Extract tag
40+
if: |
41+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
42+
id: tag
43+
run: |
44+
tag=$(echo ${{ github.ref }} | sed -e 's,^refs/tags/,,')
45+
echo ::set-output name=name::${tag}
46+
- uses: actions/setup-ruby@v1
47+
if: |
48+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
49+
- name: Extract the news for the current release
50+
if: |
51+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
52+
run: |
53+
ruby extract-news.rb ${{ steps.tag.outputs.name }} | tee news-current.md
54+
- uses: actions/create-release@v1
55+
if: |
56+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
57+
id: create-release
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
tag_name: ${{ github.ref }}
62+
release_name: Release ${{ steps.tag.outputs.name }}
63+
body_path: news-current.md
64+
- uses: actions/upload-release-asset@v1
65+
if: |
66+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
upload_url: ${{ steps.create-release.outputs.upload_url }}
71+
asset_path: libgcroots-${{ steps.tag.outputs.name }}.gz
72+
asset_name: libgcroots-${{ steps.tag.outputs.name }}.gz
73+
asset_content_type: application/gzip
74+
- uses: actions/upload-release-asset@v1
75+
if: |
76+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
with:
80+
upload_url: ${{ steps.create-release.outputs.upload_url }}
81+
asset_path: libgcroots-${{ steps.tag.outputs.name }}.bz2
82+
asset_name: libgcroots-${{ steps.tag.outputs.name }}.bz2
83+
asset_content_type: application/x-bzip2
84+
- uses: actions/upload-release-asset@v1
85+
if: |
86+
startsWith(github.ref, 'refs/tags/') && matrix.image == 'debian-10'
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
upload_url: ${{ steps.create-release.outputs.upload_url }}
91+
asset_path: libgcroots-${{ steps.tag.outputs.name }}.sum
92+
asset_name: libgcroots-${{ steps.tag.outputs.name }}.sum
93+
asset_content_type: text/plain

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, :) # :)
4545
AC_PROG_INSTALL
4646
AC_PATH_PROGS(MD5, md5 md5sum)
4747
AC_PATH_PROGS(SHA1, sha1 sha1sum)
48+
AC_PATH_PROGS(SHA256, sha256 sha256sum)
4849

4950
. ${srcdir}/configure.host
5051

extract-news.rb

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env ruby
2+
3+
tag_ref = ARGV[0]
4+
if tag_ref
5+
version = tag_ref.sub(/\Arefs\/tags\//, "")
6+
else
7+
version = nil
8+
end
9+
news = File.read(File.join(__dir__, "news.md"))
10+
11+
entries = news.split(/^## /)[1..-1]
12+
if version
13+
target_entry = entries.find do |entry|
14+
entry.start_with?("#{version} ")
15+
end
16+
else
17+
target_entry = entries.first
18+
end
19+
20+
puts("## #{target_entry}")

0 commit comments

Comments
 (0)