Skip to content

Commit 1ed411e

Browse files
whizzzkidSgtPooki
andauthored
feat: Adding Release Automation (#1122)
* Adding release automation step * blocking step * unneeded check * path renaming * feat: ♻️ Refactor ci:build:stable * feat: 📦 Create Release Asset for Stable Env --------- Co-authored-by: Russell Dempsey <[email protected]>
1 parent 65fe66c commit 1ed411e

File tree

2 files changed

+68
-7
lines changed

2 files changed

+68
-7
lines changed

.github/workflows/ci.yml

+64-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424

2525
steps:
2626
- name: Check out Git repository
27-
uses: actions/checkout@v1
27+
uses: actions/checkout@v3.3.0
2828

2929
- name: Install Node.js
30-
uses: actions/setup-node@v1
30+
uses: actions/setup-node@v3.6.0
3131
with:
3232
node-version: 18
3333

@@ -39,7 +39,7 @@ jobs:
3939
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
4040
4141
- name: Restore .cache
42-
uses: actions/cache@v2
42+
uses: actions/cache@v3.2.4
4343
id: cache
4444
with:
4545
path: ${{ github.workspace }}/.cache
@@ -50,7 +50,7 @@ jobs:
5050
5151
- name: Restore node_modules
5252
id: yarn-cache
53-
uses: actions/cache@v2
53+
uses: actions/cache@v3.2.4
5454
with:
5555
path: node_modules
5656
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
@@ -84,11 +84,70 @@ jobs:
8484
# - action artifacts can be downloaded for 90 days, then are removed by github
8585
# - binaries in PRs from forks won't be signed
8686
- name: Attach produced packages to Github Action
87-
uses: actions/upload-artifact@v2
87+
uses: actions/upload-artifact@v3.1.2
8888
with:
8989
name: built-on-${{ matrix.os }}
9090
path: build/ipfs_companion*.*
9191
if-no-files-found: error
9292

9393
- name: Show Cache
9494
run: du -h ${{ github.workspace }}/.cache/* || true
95+
96+
release-pr:
97+
runs-on: ubuntu-latest
98+
needs: [test]
99+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
100+
steps:
101+
- uses: google-github-actions/[email protected]
102+
with:
103+
release-type: node
104+
package-name: ipfs-companion
105+
changelog-notes-type: github
106+
command: release-pr
107+
108+
release-assets:
109+
runs-on: ubuntu-latest
110+
needs: [test]
111+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
112+
steps:
113+
- name: Check out Git repository
114+
uses: actions/[email protected]
115+
116+
- name: Install Node.js
117+
uses: actions/[email protected]
118+
with:
119+
node-version: 18
120+
121+
- name: Restore .cache
122+
uses: actions/[email protected]
123+
id: cache
124+
with:
125+
path: ${{ github.workspace }}/.cache
126+
key: ${{ runner.os }}-${{ hashFiles('package*json', 'package-lock.json', '*config.js') }}
127+
restore-keys: |
128+
${{ runner.os }}-${{ hashFiles('package*json', 'package-lock.json', '*config.js') }}
129+
${{ runner.os }}-
130+
131+
- name: Restore node_modules
132+
id: yarn-cache
133+
uses: actions/[email protected]
134+
with:
135+
path: node_modules
136+
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
137+
138+
- name: Install dependencies
139+
if: steps.yarn-cache.outputs.cache-hit != 'true'
140+
run: npm run ci:install
141+
142+
- name: Build Stable Release
143+
run: npm run ci:build:stable
144+
145+
- name: Release
146+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
147+
with:
148+
files: build/*.zip
149+
fail_on_unmatched_files: true
150+
generate_release_notes: true
151+
draft: true
152+
append_body: true
153+
body: 'Automated Release, please upload artifacts to respective webstores and mark this draft as released.'

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@
5656
"ci": "run-s ci:*",
5757
"ci:install": "npm ci --prefer-offline --no-audit --progress=false",
5858
"ci:build": "npm run build",
59+
"ci:build:stable": "RELEASE_CHANNEL=stable npm run ci:build",
60+
"ci:build:beta": "RELEASE_CHANNEL=beta npm run ci:build",
5961
"ci:test": "npm test",
6062
"ci:lint": "npm run lint",
61-
"beta-build": "docker rmi -f ipfs-companion-beta-build && docker build -t ipfs-companion-beta-build --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=$(id -g ${USER}) . && mkdir -p build && docker run --rm --net=host -e RELEASE_CHANNEL=beta -v $(pwd)/build:/home/node/app/build ipfs-companion-beta-build npm run ci:build",
62-
"release-build": "docker rmi -f ipfs-companion-release-build && docker build -t ipfs-companion-release-build --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=$(id -g ${USER}) . && mkdir -p build && docker run --rm --net=host -e RELEASE_CHANNEL=stable -v $(pwd)/build:/home/node/app/build ipfs-companion-release-build npm run ci:build",
63+
"beta-build": "docker rmi -f ipfs-companion-beta-build && docker build -t ipfs-companion-beta-build --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=$(id -g ${USER}) . && mkdir -p build && docker run --rm --net=host -v $(pwd)/build:/home/node/app/build ipfs-companion-beta-build npm run ci:build:beta",
64+
"release-build": "docker rmi -f ipfs-companion-release-build && docker build -t ipfs-companion-release-build --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=$(id -g ${USER}) . && mkdir -p build && docker run --rm --net=host -v $(pwd)/build:/home/node/app/build ipfs-companion-release-build npm run ci:build:stable",
6365
"dev-build": "npm ci && cross-env NODE_ENV='development' npm run build",
6466
"yarn-build": "npm run dev-build",
6567
"compose:e2e:prepare": "docker compose --file docker-compose.e2e.yml pull && docker compose --file docker-compose.e2e.yml build",

0 commit comments

Comments
 (0)