Skip to content

Commit b520a5e

Browse files
Upgrade release workflow to match the template (#60)
1 parent 9516fc5 commit b520a5e

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1+
# Publish to GitHub Packages and release the project.
2+
# To trigger, create a tag (not a release) with semantic
3+
# versioning (the tag must start with a v).
4+
#
5+
# git tag -a v0.2 -m "Version 0.2"
6+
# git push --tags
7+
#
8+
# This workflow will automatically:
9+
# - build the project using Maven;
10+
# - publish the built project as a Maven package in the project's
11+
# Maven repository, at https://maven.zcraft.fr/<repo-name>;
12+
# - create a new draft release;
13+
# - attach the built project to the release.
14+
115
name: Publish new release
16+
217
on:
318
push:
419
tags:
@@ -8,17 +23,29 @@ jobs:
823
publish:
924
runs-on: ubuntu-latest
1025
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-java@v1
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
29+
- name: Setup Java
30+
uses: actions/setup-java@v1
1331
with:
1432
java-version: 8
33+
1534
- uses: actions/cache@v2
1635
with:
1736
path: ~/.m2
1837
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
1938
restore-keys: ${{ runner.os }}-m2
39+
40+
- name: Extract project name
41+
id: project-name
42+
uses: actions/github-script@v3
43+
with:
44+
script: return context.repo.repo
45+
result-encoding: string
46+
2047
- name: Publish to GitHub Packages
21-
id: maven_publish
48+
id: maven-publish
2249
run: |
2350
TAG_NAME=${GIT_REF_NAME##*/}
2451
REVISION_NAME=${TAG_NAME:1}
@@ -32,22 +59,24 @@ jobs:
3259
env:
3360
GIT_REF_NAME: ${{ github.ref }}
3461
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
3563
- name: Create new GitHub Release
36-
id: create_release
64+
id: create-release
3765
uses: actions/create-release@v1
3866
env:
3967
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4068
with:
4169
tag_name: ${{ github.ref }}
42-
release_name: QuartzLib ${{ github.ref }}
70+
release_name: ${{ steps.project-name.outputs.result }} ${{ github.ref }}
4371
draft: true
4472
prerelease: false
73+
4574
- name: Upload GitHub Release Asset
4675
uses: actions/upload-release-asset@v1
4776
env:
4877
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4978
with:
50-
upload_url: ${{ steps.create_release.outputs.upload_url }}
51-
asset_path: ${{ steps.maven_publish.outputs.jar_path }}
52-
asset_name: ${{ steps.maven_publish.outputs.jar_name }}
53-
asset_content_type: application/java-archive
79+
upload_url: ${{ steps.create-release.outputs.upload_url }}
80+
asset_path: ${{ steps.maven-publish.outputs.jar_path }}
81+
asset_name: ${{ steps.maven-publish.outputs.jar_name }}
82+
asset_content_type: application/java-archive

0 commit comments

Comments
 (0)