Skip to content

Commit 95a3c77

Browse files
authored
Merge pull request #12 from meeDamian/release-v2
Version 2
2 parents 918936f + fb49d82 commit 95a3c77

5 files changed

Lines changed: 175 additions & 144 deletions

File tree

.github/workflows/on-tag.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Create shortened tags
33
# Only triggered on git tag push
44
on:
55
push:
6-
tags:
7-
- '*'
6+
tags: [ '*' ]
87

98
jobs:
109
shorten:
@@ -15,29 +14,29 @@ jobs:
1514

1615
- name: Make sure that current tag is merged to master
1716
run: |
18-
cd "${GITHUB_WORKSPACE}"
17+
cd "$GITHUB_WORKSPACE"
1918
2019
git switch master
2120
2221
# Returns 1 if it's not, and therefore terminates the workflow
23-
git merge-base --is-ancestor "${GITHUB_SHA}" HEAD
22+
git merge-base --is-ancestor "$GITHUB_SHA" HEAD
2423
2524
- name: Create, or update the short-name branch
2625
run: |
27-
cd "${GITHUB_WORKSPACE}"
26+
cd "$GITHUB_WORKSPACE"
2827
29-
git config user.name "${GITHUB_ACTOR}"
30-
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
28+
git config user.name "$GITHUB_ACTOR"
29+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
3130
32-
TAG=$(echo "${GITHUB_REF}" | awk -F/ '{print $NF}')
33-
SHORT=$(echo "${TAG}" | tr -d v | cut -d. -f-2)
31+
TAG=$(echo "$GITHUB_REF" | awk -F/ '{print $NF}')
32+
SHORT=$(echo "${TAG#v}" | cut -d. -f-2)
3433
3534
# Do nothing on test tags
36-
if [[ "${SHORT}" = "0.0" ]]; then
35+
if [[ "$SHORT" = "0.0" ]]; then
3736
exit 0
3837
fi
3938
40-
git branch -f "${SHORT}" "${TAG}"
39+
git branch -f "$SHORT" "$TAG"
4140
42-
REMOTE="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
43-
git push --force "${REMOTE}" "${SHORT}"
41+
REMOTE="https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
42+
git push --force "$REMOTE" "$SHORT"

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
FROM alpine:3.10
1+
FROM alpine:3.11
22

3-
RUN apk update \
4-
&& apk add file curl jq
3+
RUN apk add --no-cache file curl jq
54

65
COPY entrypoint.sh /
76

8-
ENTRYPOINT ["/entrypoint.sh"]
7+
ENTRYPOINT [ "/entrypoint.sh" ]

README.md

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@
1515

1616
Github Action to create and update Github Releases, as well as upload assets to them.
1717

18-
> ### **NOTICE:** This action is now deprecated, and official actions should be used instead:
18+
19+
> ### **NOTICE_2:** Deprecation <small>temporarily</small> cancelled, because GH actions are just awful.
20+
>
21+
> ### ~~**NOTICE:** This action is now deprecated, and official actions should be used instead:~~
1922
>
20-
> * https://github.com/actions/create-release
21-
> * https://github.com/actions/upload-release-asset
23+
> * ~~https://github.com/actions/create-release~~
24+
> * ~~https://github.com/actions/upload-release-asset~~
25+
2226

2327
# Usage
2428

2529
See [action.yml](action.yml)
2630

31+
2732
### Minimal
2833

2934
```yaml
3035
steps:
31-
- uses: actions/checkout@v1
36+
- uses: actions/checkout@v2
3237

33-
- uses: meeDamian/github-release@1.0
38+
- uses: meeDamian/github-release@2.0
3439
with:
35-
token: ${{secrets.GITHUB_TOKEN}}
40+
token: ${{ secrets.GITHUB_TOKEN }}
3641
```
3742
3843
`token` is the only **always required** parameter to be passed to this action. Everything else can use sane defaults in some circumstances. See [arguments] to learn more.
@@ -44,22 +49,23 @@ steps:
4449

4550
All inputs are available as a _normal_ Action input, but because Github Actions don't accept shell variables there, some are also available as an Environment Variable set beforehand. When both set, one set as input takes precedence.
4651

47-
| name | ENV var alternative | required | description
48-
|:----------------:|:-------------------:|:----------:|----------------
49-
| `token` | - | **always** | Github Access token. Can be accessed by using `${{secrets.GITHUB_TOKEN}}` in the workflow file.
50-
| `tag` | `RELEASE_TAG` | sometimes | If triggered by git tag push, tag is picked up automatically. Otherwise `tag:` has to be set. For tags constructed dynamically, use `RELEASE_TAG` env var.
51-
| `commitish` | - | no | Commit hash this release should point to. Unnecessary, if `tag` is a git tag. Otherwise, current `master` is used. [more]
52-
| `name` | `RELEASE_NAME` | no | Place to name the release, the more creative, the better. Defaults to the name of the tag used. [more]
53-
| `body` | - | no | Place to put a longer description of the release, ex changelog, or info about contributors. Defaults to the commit message of the reference commit. [more]
54-
| `draft` | - | no | Set to `true` to create a release, but not publish it. `false` by default. [more]
55-
| `prerelease` | - | no | Marks this release as a pre-release. `false` by default. [more]
56-
| `files` | `RELEASE_FILES` | no | A **space-separated** list of files to be uploaded. When left empty, no files are uploaded. [More on files below]
57-
| `gzip` | - | no | Set whether to `gzip` uploaded assets, or not. Available options are: `true`, `false`, and `folders` which uploads files unchanged, but compresses directories/folders. Defaults to `true`. Note: it errors if set to `false`, and `files:` argument contains path to a directory.
58-
| `allow_override` | - | no | Allow override of release, if one with the same tag already exists. Defaults to `false`
52+
| name | required | description
53+
|:----------------:|:----------:|----------------
54+
| `token` | **always** | Github Access token. Can be accessed by using `${{ secrets.GITHUB_TOKEN }}` in the workflow file.
55+
| `tag` | sometimes | If triggered by git tag push, tag is picked up automatically. Otherwise `tag:` has to be set.
56+
| `commitish` | no | Commit hash this release should point to. Unnecessary, if `tag` is a git tag. Otherwise, current `master` is used. [more]
57+
| `name` | no | Name the release, the more creative, the better. Defaults to the name of the tag used. [more]
58+
| `body` | no | Longer description of the release, ex changelog, or info about contributors. Defaults to the commit message of the reference commit. [more]
59+
| `draft` | no | Set to `true` to create a release, but not publish it. `false` by default. [more]
60+
| `prerelease` | no | Mark this release as a pre-release. `false` by default. [more]
61+
| `files` | no | A **space-separated** list of files to be uploaded. When left empty, no files are uploaded. [More on files below]
62+
| `gzip` | no | Set whether to `gzip` uploaded assets, or not. Available options are: `true`, `false`, and `folders` which uploads files unchanged, but compresses directories/folders. Defaults to `true`. Note: it errors if set to `false`, and `files:` argument contains path to a directory.
63+
| `allow_override` | no | Allow override of release, if one with the same tag already exists. Defaults to `false`
5964

6065
[more]: https://developer.github.com/v3/repos/releases/#create-a-release
6166
[More on files below]: #Files-syntax
6267

68+
6369
#### Using ENV vars
6470

6571
In a step before this action, run ex:
@@ -70,21 +76,24 @@ steps:
7076
- name: Set enviroment for github-release
7177
run: |
7278
echo ::set-env name=RELEASE_TAG::"v1.0.0"
73-
echo ::set-env name=RELEASE_NAME::"${GITHUB_WORKFLOW}"
79+
echo ::set-env name=RELEASE_NAME::"$GITHUB_WORKFLOW"
7480
75-
- uses: meeDamian/github-release@1.0
81+
- uses: meeDamian/github-release@2.0
7682
with:
77-
token: ${{secrets.GITHUB_TOKEN}}
83+
token: ${{ secrets.GITHUB_TOKEN }}
84+
tag: ${{ env.RELEASE_TAG }}
85+
name: ${{ env.RELEASE_NAME }}
7886
...
7987
```
8088

8189
To learn more about notation used above see [this].
8290

8391
[this]: https://help.github.com/en/articles/development-tools-for-github-actions#set-an-environment-variable-set-env
8492

93+
8594
#### Files syntax
8695

87-
In it's simplest form it takes a single file/folder to be compressed & uploaded:
96+
In its simplest form it takes a single file/folder to be compressed & uploaded:
8897

8998
```yaml
9099
with:
@@ -113,16 +122,17 @@ with:
113122
```
114123
[YAML multiline syntax]: https://yaml-multiline.info/
115124

125+
116126
### Advanced example
117127

118128
```yaml
119129
steps:
120130
- uses: actions/checkout@master
121131
122-
- uses: meeDamian/github-release@0.1
132+
- uses: meeDamian/github-release@2.0
123133
with:
124134
token: ${{ secrets.GITHUB_TOKEN }}
125-
tag: v1.3.6
135+
tag: ${{ env.MY_CUSTOM_TAG }}
126136
name: My Creative Name
127137
body: >
128138
This release actually changes the fabric of the reality, so be careful
@@ -151,20 +161,23 @@ In practice:
151161
```yaml
152162
# For exact version
153163
steps:
154-
uses: meeDamian/github-release@v1.0.1
164+
uses: meeDamian/github-release@v2.0.0
155165
```
166+
156167
Or
168+
157169
```yaml
158-
# For newest minor version 1.0
170+
# For newest minor version 2.0
159171
steps:
160-
uses: meeDamian/github-release@1.0
172+
uses: meeDamian/github-release@2.0
161173
```
162174

163175
Note: It's likely branches will be deprecated once Github Actions fixes its limitation.
164176

165177
[The insane thing]: https://git-scm.com/docs/git-tag#_on_re_tagging
166178
[here]: .github/workflows/on-tag.yml
167179

180+
168181
# License
169182

170183
The scripts and documentation in this project are released under the [MIT License](LICENSE)

action.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,33 @@ inputs:
1313

1414
tag:
1515
description: >
16-
A tag for the release. Required UNLESS action is run on tag push (meaning: `${GITHUB_REF}` contains `ref/tag/<TAG>`).
16+
A tag for the release. Required UNLESS action is run on tag push (meaning: `$GITHUB_REF` contains `ref/tag/<TAG>`).
1717
required: false
1818

1919
commitish:
20-
description: Unnecessary, if the tag provided is a git tag. If it isn't release will be made off `master`.
20+
description: Unnecessary, if the tag provided is a git tag. If it isn't, release will be made off `master`.
2121
required: false
2222

2323
name:
24-
description: Place to name the release, the more creative, the better.
24+
description: Name the release, the more creative, the better.
2525
required: false
2626

2727
body:
28-
description: Place to put a longer description of the release, ex changelog, or info about contributors.
28+
description: Longer description of the release, ex changelog, or info about contributors.
2929
required: false
3030

3131
draft:
32-
description: Set to true to create a release, but not publish it.
32+
description: >
33+
Whether to keep the Release as draft, and not publish it. Defaults to 'false', unless files are specified, when
34+
a draft Release is created first, and published only if all asset uploads succeed. Prevent by explicitly setting
35+
it to 'false'.
3336
required: false
3437

3538
prerelease:
3639
description: Marks this as a pre-release.
3740
required: false
3841

39-
# This action specific inputs:
42+
# Inputs specific to this-action:
4043
files:
4144
description: >
4245
A space-separated(!) list of files to be uploaded. It's impossible to pass a list here, so make sure filenames

0 commit comments

Comments
 (0)