-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.74 KB
/
pre-release.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
56
57
58
name: Pre-Release
on:
push:
branches:
- '*'
- '!main'
jobs:
pre_release:
name: Pre-Release
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
node-version: [ '20' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: |
npm install
- name: Set Branch Name
id: set_branch_name
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo $BRANCH_NAME
- name: Check for existing release
id: check_release
run: |
TAG_NAME="v${{ steps.set_branch_name.outputs.branch_name }}"
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.PAT_TOKEN }}" "https://api.github.com/repos/action-pylint/releases/tags/${TAG_NAME}" | jq -r '.id // empty')
echo "::set-output name=release_id::${RELEASE_ID}"
- name: Delete existing release
if: steps.check_release.outputs.release_id != ''
run: |
curl -X DELETE -s -H "Authorization: token ${{ secrets.PAT_TOKEN }}" "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ steps.check_release.outputs.release_id }}"
- name: Create Pre-Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.set_branch_name.outputs.branch_name }}
release_name: v${{ steps.set_branch_name.outputs.branch_name }}
prerelease: true