-
Notifications
You must be signed in to change notification settings - Fork 185
128 lines (108 loc) · 3.8 KB
/
stage.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
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
122
123
124
125
126
127
128
---
name: Stage
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'fabric8-analytics'
name: Build plugin
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create .npmrc
run: |
echo "@RHEcosystemAppEng:registry=https://npm.pkg.github.com" > ~/.npmrc
echo "@fabric8-analytics:registry=https://npm.pkg.github.com" >> ~/.npmrc
- name: Install @vscode/vsce
run: npm i -g @vscode/vsce
- name: Install Dependencies
run: npm ci
- name: Compile for test
run: npm run test-compile
- name: VSCE package
run: vsce package --out fabric8-analytics-early-access.vsix
- name: Upload vsix package as artifact
uses: actions/upload-artifact@v3
with:
name: vsix
path: ./fabric8-analytics-early-access.vsix
release:
permissions: write-all
runs-on: ubuntu-latest
name: Create an early-access release
environment: staging
needs: build
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update package with new version
id: bump
run: |
echo "version=$(npm version ${{ vars.VERSION_BUMPING_TYPE }} --no-git-tag-version)" >> "$GITHUB_OUTPUT"
- name: Download vsix package artifact
uses: actions/download-artifact@v3
with:
name: vsix
path: ./vsix
- name: Commit and push package modifications
run: |
git add package.json
git add package-lock.json
git commit -m "build: updated package with ${{ steps.bump.outputs.version }} [skip ci]"
git push
- name: Create and push new tag
run: |
git tag ${{ steps.bump.outputs.version }} -m "${{ steps.bump.outputs.version }}"
git push origin ${{ steps.bump.outputs.version }}
- name: Create a release
id: new_release
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const repo_name = context.payload.repository.full_name
const response = await github.request('POST /repos/' + repo_name + '/releases', {
tag_name: '${{ steps.bump.outputs.version }}',
name: '${{ steps.bump.outputs.version }}',
prerelease: true,
generate_release_notes: true
})
core.setOutput('upload_url', response.data.upload_url)
- name: Create SHA256 checksums for the binaries
working-directory: vsix
run: |
for pkg in *
do
sha256sum "$pkg" > "$pkg.sha256"
done
- name: Upload packages and checksums as early-access release assets
working-directory: vsix
run: |
for file in *
do
asset_name=$(basename "$file")
upload_url=$(echo "${{ steps.new_release.outputs.upload_url }}" | sed "s/{?name,label}/?name=$asset_name/g")
curl --data-binary @"$file" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
"$upload_url"
done