Skip to content

Commit be64115

Browse files
authored
ci: reflect changes made in next branch (#3911)
Refs #3900
1 parent c8afbfe commit be64115

File tree

3 files changed

+52
-44
lines changed

3 files changed

+52
-44
lines changed

.github/workflows/docker-build-push.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@ jobs:
2020
with:
2121
ref: next
2222

23-
# - name: Download build artifact
24-
# uses: actions/github-script@v6
25-
# with:
26-
# script: |
27-
# const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
28-
# owner: context.repo.owner,
29-
# repo: context.repo.repo,
30-
# run_id: context.payload.workflow_run.id,
31-
# });
32-
# const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
33-
# return artifact.name == "build"
34-
# })[0];
35-
# const download = await github.rest.actions.downloadArtifact({
36-
# owner: context.repo.owner,
37-
# repo: context.repo.repo,
38-
# artifact_id: matchArtifact.id,
39-
# archive_format: 'zip',
40-
# });
41-
# const fs = require('fs');
42-
# fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));
23+
- name: Download build artifact
24+
uses: actions/github-script@v6
25+
with:
26+
script: |
27+
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
run_id: context.payload.workflow_run.id,
31+
});
32+
const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
33+
return artifact.name == "build"
34+
})[0];
35+
const download = await github.rest.actions.downloadArtifact({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
artifact_id: matchArtifact.id,
39+
archive_format: 'zip',
40+
});
41+
const fs = require('fs');
42+
fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));
4343
- run: |
4444
mkdir build
45-
# unzip build.zip -d build
45+
unzip build.zip -d build
4646
4747
- name: Determine released version
4848
uses: actions/github-script@v6
@@ -85,7 +85,7 @@ jobs:
8585
uses: docker/build-push-action@v4
8686
with:
8787
context: .
88-
push: false
88+
push: true
8989
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,linux/ppc64le,linux/s390x
9090
tags: swaggerapi/swagger-editor:next-v5,swaggerapi/swagger-editor:v${{ env.RELEASED_VERSION }}
9191

@@ -94,6 +94,6 @@ jobs:
9494
with:
9595
context: .
9696
file: Dockerfile.unprivileged
97-
push: false
97+
push: true
9898
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,linux/ppc64le,linux/s390x
9999
tags: swaggerapi/swagger-editor:next-v5-unprivileged,swaggerapi/swagger-editor:v${{ env.RELEASED_VERSION }}-unprivileged

.github/workflows/nightly-build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
# Do not modify this file.
2+
# Github Actions only recognizes `workflow_run` and `workflow_dispatch`
3+
# events that are located in the default branch
4+
15
name: SwaggerEditor@next nightly build
26

37
on:
48
workflow_dispatch:
59
schedule:
6-
- cron: '30 03 * * *'
10+
- cron: '30 22 * * *'
711

812
jobs:
913
nightly-build:
@@ -19,8 +23,6 @@ jobs:
1923
uses: actions/setup-node@v3
2024
with:
2125
node-version: 16.16
22-
registry-url: https://npm.pkg.github.com/
23-
scope: "@swagger-api"
2426

2527
- name: Cache npm cache files
2628
id: cache-npm-cache-files
@@ -37,8 +39,6 @@ jobs:
3739

3840
- name: Install dependencies
3941
run: npm ci
40-
env:
41-
NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
4242

4343
- name: Lint code
4444
run: npm run lint
@@ -66,5 +66,5 @@ jobs:
6666
- name: Upload npm artifact
6767
uses: actions/upload-artifact@v3
6868
with:
69-
name: "swagger-api-swagger-editor-next.tgz"
70-
path: ./swagger-api-swagger-editor-next-*.tgz
69+
name: "swagger-editor-next.tgz"
70+
path: ./swagger-editor-*.tgz

.github/workflows/release.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,31 @@ jobs:
1717
submodules: true
1818
ref: next
1919

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version: 16
24-
registry-url: https://npm.pkg.github.com/
25-
scope: "@swagger-api"
26-
2720
- name: Determine the next release version
2821
uses: cycjimmy/semantic-release-action@v3
2922
with:
30-
dry_run: true
23+
dry_run: false
3124
extra_plugins: |
3225
@semantic-release/git
3326
@semantic-release/exec
3427
env:
3528
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
36-
NPM_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
37-
NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
29+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3830

3931
- name: Nothing to release
4032
if: ${{ env.NEXT_RELEASE_VERSION == '' }}
4133
uses: actions/github-script@v6
4234
with:
4335
script: |
4436
core.setFailed('Nothing to release')
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v3
40+
with:
41+
node-version: 16
42+
4543
- name: Install dependencies
4644
run: npm ci
47-
env:
48-
NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
4945

5046
- name: Prepare for the Release
5147
env:
@@ -57,6 +53,7 @@ jobs:
5753
npm run cy:ci
5854
npm run build:bundle:esm
5955
npm run build:bundle:umd
56+
6057
- name: Semantic Release
6158
id: semantic
6259
uses: cycjimmy/semantic-release-action@v3
@@ -66,8 +63,7 @@ jobs:
6663
@semantic-release/git
6764
env:
6865
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
69-
NPM_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
70-
NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
66+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7167

7268
- name: Release failed
7369
if: steps.semantic.outputs.new_release_published == 'false'
@@ -88,3 +84,15 @@ jobs:
8884
with:
8985
name: build
9086
path: ./build
87+
88+
89+
- name: Prepare released version for uploading
90+
shell: bash
91+
run: |
92+
echo ${{ steps.semantic.outputs.new_release_version }} > released-version.txt
93+
- name: Upload released version
94+
uses: actions/upload-artifact@v3
95+
with:
96+
name: released-version
97+
path: ./released-version.txt
98+
retention-days: 1

0 commit comments

Comments
 (0)