forked from redhat-developer/vscode-paver
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (111 loc) · 4.02 KB
/
release.yaml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Release build
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
inputs:
EXTENSION_TAG:
description: "branch/tag of the extension to build."
type: string
default: main
publishPreRelease:
description: "Publish a pre-release ?"
required: true
type: choice
options:
- "true"
- "false"
default: "true"
publishToMarketPlace:
description: "Publish to VS Code Marketplace ?"
required: true
type: choice
options:
- "true"
- "false"
default: "false"
publishToOVSX:
description: "Publish to OpenVSX Registry ?"
required: true
type: choice
options:
- "true"
- "false"
default: "false"
jobs:
should-build-change:
runs-on: ubuntu-latest
outputs:
repo-cache-hit: ${{ steps.cache-last-commit.outputs.cache-hit }}
steps:
- uses: actions/checkout@v4
- run: |
git rev-parse HEAD >> ./lastCommit
- name: Check New Changes
id: cache-last-commit
uses: actions/cache@v4
with:
path: lastCommit
key: lastCommit-${{ hashFiles('lastCommit') }}
release-job:
runs-on: ubuntu-latest
needs: should-build-change
if: ${{ needs.should-build-change.outputs.repo-cache-hit != 'true' || github.event_name != 'schedule' }}
steps:
- name: Checkout Extension
uses: actions/checkout@v4
with:
ref: ${{ inputs.EXTENSION_TAG }}
- name: Set Up NodeJS
uses: actions/setup-node@v4
with:
node-version: "20"
# Run install dependencies
- name: Install dependencies
run: npm run install:ci
- name: Prepare Pre-Release version
if: ${{ github.event_name == 'schedule' || inputs.publishPreRelease == 'true' }}
run: |
node ./releng/create-package-insiders-json.js
mv ./package.insiders.json ./package.json
echo "publishPreReleaseFlag=--pre-release" >> $GITHUB_ENV
- name: Package extension
run: |
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
npx @vscode/vsce package ${{ env.publishPreReleaseFlag }}
- name: Publish to GH Release Tab
if: ${{ github.event_name != 'schedule' && inputs.publishPreRelease == 'false' }}
uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.EXT_VERSION }}"
title: "${{ env.EXT_VERSION }}"
draft: true
files: |
vscode-paver-*.vsix
- name: Publish to VS Code Marketplace
if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }}
run: |
npx @vscode/vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-paver-${{ env.EXT_VERSION }}.vsix
- name: Publish to OpenVSX Registry
if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }}
run: |
npx ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-paver-${{ env.EXT_VERSION }}.vsix
post-release-job:
if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' && inputs.EXTENSION_TAG == 'main' }}
runs-on: ubuntu-latest
needs: release-job
steps:
- name: Check out Extension
uses: actions/checkout@v4
- name: Set Up NodeJS
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Upversion for Development
run: |
tag=`npm version --no-git-tag-version patch`
git config --global user.email "[email protected]"
git config --global user.name "redhat-developer-bot"
git commit -am "Upversion to ${tag#v}"
git push origin