-
Notifications
You must be signed in to change notification settings - Fork 824
130 lines (113 loc) · 4.45 KB
/
master.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
129
130
# Actions that run when PRs are merged into master, or code is pushed to it.
name: Master
on:
push:
branches:
- master
jobs:
build-test-and-release:
runs-on: ubuntu-latest
name: Build, run tests and release
steps:
- uses: actions/checkout@v4
- name: Build setup
uses: ./.github/actions/build-setup
- name: Set env.RELEASE_PREFIX from package.json
run: |
version=$(jq -r .version packages/app-extension/package.json)
echo "RELEASE_PREFIX=$version" >> $GITHUB_ENV
echo $version
##########################################################################
# Build extension.
##########################################################################
- run: yarn build
env:
BACKPACK_CONFIG_VERSION: "${{ env.RELEASE_PREFIX }}-latest-beta-${{ github.run_number }}"
BACKPACK_CONFIG_GITHUB_RUN_NUMBER: "${{ github.run_number }}"
BACKPACK_CONFIG_LOG_LEVEL: "info"
BACKPACK_FEATURE_LIGHT_MODE: "true"
BACKPACK_FEATURE_POP_MODE: "true"
BACKPACK_FEATURE_XNFT: "true"
BACKPACK_FEATURE_FORCE_LATEST_VERSION: "true"
# CI!=true so that build warnings aren't treated like errors (for now)
CI: ""
- name: "rename beta build"
working-directory: packages/app-extension
run: mv build build-beta
##########################################################################
# Tests.
##########################################################################
- run: yarn test
##########################################################################
# Upload build artifacts.
##########################################################################
#
# Upload beta artifact.
#
- name: "zip beta build artifacts"
working-directory: packages/app-extension
run: zip -r build-beta-${{ github.run_number }}.zip build-beta/
- name: "upload build artifacts"
uses: actions/upload-artifact@v2
with:
name: backpack-build-beta
path: packages/app-extension/build-beta-${{ github.run_number }}.zip
##########################################################################
# Release.
##########################################################################
#
# Download artifacts.
#
- uses: actions/download-artifact@v2
with:
name: backpack-build-beta
path: ./
#
# Create release.
#
- uses: actions/create-release@v1
name: Create Draft Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_PREFIX }}-latest-${{ github.run_number }}
release_name: ${{ env.RELEASE_PREFIX }}-latest-${{ github.run_number }}
draft: false
prerelease: false
#
# Attach files to the release.
#
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build-beta-${{ github.run_number }}.zip
asset_name: build-beta-${{ github.run_number }}.zip
asset_content_type: application/zip
##########################################################################
# NPM Publish.
##########################################################################
- name: "update npm package version"
run: ./scripts/npm_release.sh ${{ env.RELEASE_PREFIX }}-latest.${{ github.run_number }}
- name: "publish to npm: common"
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_ACCESS_TOKEN }}
tag: latest
package: packages/common/package.json
- name: "publish to npm: @coral-xyz/xnft-cli"
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_ACCESS_TOKEN }}
tag: latest
package: packages/xnft-cli/package.json
- name: "change @coral-xyz/xnft-cli package name to xnft"
run: sed -i 's/"@coral-xyz\/xnft-cli"/"xnft"/g' packages/xnft-cli/package.json
- name: "publish to npm: xnft"
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_ACCESS_TOKEN }}
tag: latest
package: packages/xnft-cli/package.json