-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (51 loc) · 1.69 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Release
on:
workflow_dispatch:
inputs:
sha:
description: "SHA (leave blank for HEAD)"
required: false
env:
ACTIONS_API_URL: https://api.github.com/repos/${GITHUB_REPOSITORY}/actions
VERSION_START_SHA: b215f9452b622c4465871a1a3a69579a6ba2ccc0
jobs:
version:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
tag: ${{ steps.version.outputs.tag }}
steps:
- id: sha
run: |
SHA=$(if [[ "${{ github.event.inputs.sha }}" ]]; then echo "${{ github.event.inputs.sha }}"; else echo "${GITHUB_SHA}"; fi)
SHA7="${SHA::7}"
echo "::set-output name=sha::${SHA}"
echo "::set-output name=sha7::${SHA7}"
- uses: actions/checkout@v2
with:
ref: ${{ steps.sha.outputs.sha }}
fetch-depth: 0
- id: version
run: |
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..${{ steps.sha.outputs.sha }} --count)
TAG="${REVISION}-${{ steps.sha.outputs.sha7 }}"
echo "::set-output name=tag::${TAG}"
release:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- uses: actions/checkout@master
- name: Prepare Release Package
id: prepare_release
uses: thedoctor0/zip-release@main
with:
type: 'zip'
filename: 'pinball-core-part-lib.zip'
exclusions: '*.git* /*References/*'
- uses: ncipollo/release-action@v1
with:
artifacts: 'pinball-core-part-lib.zip'
token: ${{ secrets.GITHUB_TOKEN }}
commit: ${{ needs.version.outputs.sha }}
tag: "v${{ needs.version.outputs.tag }}"
name: "Pinball Core Parts v${{ needs.version.outputs.tag }}"