-
Notifications
You must be signed in to change notification settings - Fork 1.3k
140 lines (122 loc) · 4.57 KB
/
release.yaml
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
131
132
133
134
135
136
137
138
139
140
name: "Release"
on:
push:
branches:
- master
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: "Release"
runs-on: ubuntu-latest
permissions: write-all
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: CI Setup
uses: ./.github/actions/ci-setup
# if there are changesets present, package.json will be bumped
- name: Bump and Collect Versions
run: |
pnpm changeset version
echo "BUILD_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' packages/fuels/package.json)" >> $GITHUB_ENV
echo "FUEL_CORE_VERSION=$(cat ./packages/fuel-core/VERSION)" >> $GITHUB_ENV
echo "FORC_VERSION=$(cat ./packages/forc/VERSION)" >> $GITHUB_ENV
git reset --hard
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure NPM access
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build
run: pnpm build
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: FuelLabs/changesets-action@main
with:
publish: pnpm changeset:publish
version: pnpm changeset:version-with-docs
commit: "ci(changesets): versioning packages"
title: "ci(changesets): versioning packages"
createGithubReleases: aggregate
githubReleaseName: v${{ env.BUILD_VERSION }}
githubTagName: v${{ env.BUILD_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release to @next tag on npm
if: steps.changesets.outputs.published != 'true'
run: |
git checkout master
pnpm changeset:next
git add .changeset/fuel-labs-ci.md
pnpm changeset version --snapshot next
pnpm changeset publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ensure docs are always deployed after merge of changeset PR
- name: Get the last commit message and set env vars
run: echo LAST_COMMIT_MSG=$(git --no-pager log -1 --pretty=%B) >> $GITHUB_ENV
- name: Decides if Docs should be deployed
if: startsWith(env.LAST_COMMIT_MSG, 'ci(changesets):')
run: echo SHOULD_DEPLOY_DOCS=true >> $GITHUB_ENV
- name: Configure GitHub Pages
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/configure-pages@v2
- name: Upload Docs Artifact
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/upload-pages-artifact@v1
with:
path: apps/docs/dist
- name: Deploy Docs
if: env.SHOULD_DEPLOY_DOCS == 'true'
id: deployment
uses: actions/deploy-pages@v1
- name: Checkout API Docs
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/checkout@v3
with:
ref: docs
fetch-depth: 0
- name: Generate and Push API Docs
if: env.SHOULD_DEPLOY_DOCS == 'true'
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git merge origin/master --no-edit
pnpm install
pnpm build
rm -f apps/docs/.gitignore
git add apps/docs/src/api/
git add apps/docs/.typedoc/api-links.json
git commit -m "docs: API docs - v${{ env.BUILD_VERSION }}"
git push
git restore apps/docs/.gitignore
# Upload assets to S3
- uses: unfor19/install-aws-cli-action@v1.0.3
if: steps.changesets.outputs.published != 'true'
with:
version: 2
verbose: false
arch: amd64
rootdir: ""
workdir: ""
- uses: aws-actions/configure-aws-credentials@v1
if: steps.changesets.outputs.published != 'true'
with:
aws-access-key-id: ${{ secrets.S3_CDN_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.S3_CDN_SECRET_KEY }}
aws-region: us-east-1
- name: Upload assets to s3
if: steps.changesets.outputs.published != 'true'
run: |
aws s3 cp ./packages/account/src/providers/assets/images/ s3://${S3_CDN_BUCKET}/assets/ --recursive
env:
S3_CDN_BUCKET: ${{ secrets.S3_CDN_BUCKET }}