Skip to content

Commit 0675b26

Browse files
authored
Merge pull request #1287 from fortran-lang/ci/deployments-for-publish
ci: created isolated deployment envs for VSCode and OpenVSX
2 parents 1754c8b + dd7f229 commit 0675b26

1 file changed

Lines changed: 72 additions & 30 deletions

File tree

.github/workflows/publish.yml

Lines changed: 72 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,95 @@
1+
name: Deploy Release
2+
13
on:
24
release:
35
types: [published]
46

5-
name: Deploy Extension
67
jobs:
7-
deploy:
8+
prepare:
9+
name: Prepare Release
10+
runs-on: ubuntu-latest
11+
outputs:
12+
VERSION: ${{ steps.version.outputs.VERSION }}
13+
PRE_RELEASE: ${{ steps.pre.outputs.PRE_RELEASE }}
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
- uses: actions/setup-node@v6
19+
with:
20+
node-version: 22.x
21+
22+
- name: Capture prerelease flag
23+
id: pre
24+
run: echo "PRE_RELEASE=${{ github.event.release.prerelease }}" >> $GITHUB_OUTPUT
25+
26+
- name: Derive version from tag
27+
id: version
28+
run: |
29+
ref="${GITHUB_REF_NAME}"
30+
version="${ref#v}"
31+
echo "VERSION=$version" >> $GITHUB_OUTPUT
32+
33+
deploy-vscode:
34+
name: Publish Release (VS Code Marketplace)
35+
needs: prepare
836
runs-on: ubuntu-latest
37+
environment: publish-vscode
38+
concurrency: publish-vscode
39+
env:
40+
VERSION: ${{ needs.prepare.outputs.VERSION }}
41+
PRE_RELEASE: ${{ needs.prepare.outputs.PRE_RELEASE }}
942
steps:
1043
- uses: actions/checkout@v6
1144
- uses: actions/setup-node@v6
1245
with:
1346
node-version: 22.x
1447
- run: npm ci
1548

16-
# Package and publish the extension to VS Code Marketplace
17-
# Do not produce a git tag, only increment the version in package.json
18-
- name: Publish Release ${{ github.ref_name }}
19-
if: startsWith(github.ref, 'refs/tags/v')
49+
- name: Package and publish to VS Code Marketplace
2050
run: |
2151
npm i -g @vscode/vsce
22-
if [ "$pre_release" = true ] ; then
23-
vsce publish --no-git-tag-version --pre-release ${GITHUB_REF_NAME:1}
52+
if [ "${PRE_RELEASE}" = "true" ]; then
53+
vsce publish --no-git-tag-version --pre-release "${VERSION}"
2454
else
25-
vsce publish --no-git-tag-version ${GITHUB_REF_NAME:1}
55+
vsce publish --no-git-tag-version "${VERSION}"
2656
fi
2757
env:
28-
pre_release: ${{ github.event.release.prerelease }}
2958
VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }}
3059

31-
# Commit the new version to the repository default branch and update the tag
32-
# This removes the signing of the commit, tag and release since it's
33-
# created by the GitHub Actions bot
34-
# - name: Update package.json version
35-
# if: startsWith(github.ref, 'refs/tags/v')
36-
# run: |
37-
# git config user.name github-actions
38-
# git config user.email 41898282+github-actions[bot]@users.noreply.github.com
39-
# git switch -c tmp
40-
# git add package.json
41-
# git commit -m "ci: update version to ${GITHUB_REF_NAME:1}"
42-
# git fetch
43-
# git switch main
44-
# git merge tmp
45-
# git tag -f $GITHUB_REF_NAME
46-
# git push origin -f $GITHUB_REF_NAME
47-
# git push origin -f main
48-
49-
# Upload the artifact as a release asset
50-
- uses: softprops/action-gh-release@master
60+
- name: Upload VSIX to release assets
61+
uses: softprops/action-gh-release@master
5162
if: startsWith(github.ref, 'refs/tags/v')
5263
with:
5364
files: ./*.vsix
65+
66+
deploy-openvsx:
67+
name: Publish Release (OpenVSX)
68+
needs: prepare
69+
runs-on: ubuntu-latest
70+
environment: publish-openvsx
71+
concurrency: publish-openvsx
72+
env:
73+
VERSION: ${{ needs.prepare.outputs.VERSION }}
74+
PRE_RELEASE: ${{ needs.prepare.outputs.PRE_RELEASE }}
75+
steps:
76+
- uses: actions/checkout@v6
77+
- uses: actions/setup-node@v6
78+
with:
79+
node-version: 22.x
80+
- run: npm ci
81+
82+
- name: Apply OpenVSX patch
83+
run: node ./scripts/patch-openvsx.mjs
84+
85+
- name: Publish to OpenVSX
86+
run: |
87+
npm i -g @vscode/vsce ovsx
88+
if [ "${PRE_RELEASE}" = "true" ]; then
89+
vsce package --no-git-tag-version --pre-release "${VERSION}"
90+
else
91+
vsce package --no-git-tag-version "${VERSION}"
92+
fi
93+
ovsx publish ./*.vsix --skip-duplicate
94+
env:
95+
OVSX_PAT: ${{ secrets.OPENVSX_MARKETPLACE_TOKEN }}

0 commit comments

Comments
 (0)