-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (47 loc) · 1.34 KB
/
publish.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
name: Publish
on:
push:
tags:
- 'pending/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Setup Java 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Get Version
id: tagName
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/pending/}
- name: 'Abort if tag exists'
id: checkTagged
shell: bash
run: git show-ref --tags --verify --quiet -- "refs/tags/release/${{ steps.tagName.outputs.version }}" && exit 1 || exit 0
- name: Publish
run: echo Publishing
- name: Tag release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.RELEASE_TOKEN }}
script: |
let newRef = context.ref.replace('pending', 'release');
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: newRef,
sha: context.sha
});
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.ref.substring(5)
});