-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathhandler.publish-release-packages.yml
More file actions
142 lines (119 loc) · 5.96 KB
/
handler.publish-release-packages.yml
File metadata and controls
142 lines (119 loc) · 5.96 KB
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
141
142
name: Publish Release Package
on:
release:
types: [published]
jobs:
publish-release:
name: Publish release package
permissions: write-all
runs-on: ubuntu-22.04
defaults:
run:
shell: nix develop .#ci-default -c bash -xe {0}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: superfluid-finance/build-scripts
path: build-scripts
- uses: DeterminateSystems/nix-installer-action@v13
- name: Parse Tag
env:
GITHUB_REF: ${{ github.ref }}
run: |
if echo -n "$GITHUB_REF" | grep -qE "refs/tags/ethereum-contracts@";then
echo "PUBLISH_ETHEREUM_CONTRACTS=1" >> "$GITHUB_ENV"
fi
if echo -n "$GITHUB_REF" | grep -qE "refs/tags/sdk-core@";then
echo "PUBLISH_SDK_CORE=1" >> "$GITHUB_ENV"
fi
if echo -n "$GITHUB_REF" | grep -qE "refs/tags/sdk-redux@";then
echo "PUBLISH_SDK_REDUX=1" >> "$GITHUB_ENV"
fi
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Publish ethereum-contracts package
if: env.PUBLISH_ETHEREUM_CONTRACTS == 1
run: |
yarn --cwd packages/ethereum-contracts build
tasks/npm-publish.sh packages/ethereum-contracts/ latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: Publish sdk-core package
id: publish-sdk-core
if: env.PUBLISH_SDK_CORE == 1
run: |
yarn --cwd packages/sdk-core get-graphql-schema:v1
yarn --cwd packages/ethereum-contracts build
yarn --cwd packages/sdk-core build
tasks/npm-publish.sh packages/sdk-core/ latest
PUBLISHED_VERSION=$(jq -r .version packages/sdk-core/package.json)
echo "PUBLISHED_VERSION=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT"
# Build documentation with redirect from root
yarn --cwd packages/sdk-core doc:html
mkdir sdk-core-redirect
printf '<!DOCTYPE html><html><head><title>Redirecting...</title><meta charset="UTF-8"><meta http-equiv="refresh" content="0;URL=%s" /><meta http-equiv="Cache-Control" content="no-store" /></head><body><p>Redirecting to latest documentation...</p></body></html>' "https://refs.superfluid.finance/sdk-core@$PUBLISHED_VERSION" \
> sdk-core-redirect/index.html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: Upload sdk-core HTML documentation
if: env.PUBLISH_SDK_CORE == 1
uses: ./build-scripts/s3cloudfront-hosting/actions/sync
with:
local_build_dir: packages/sdk-core/dist/docs
aws_region: eu-west-2
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
s3_uri: ${{ format('{0}sdk-core@{1}', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI, steps.publish-sdk-core.outputs.PUBLISHED_VERSION) }}
cloudfront_distribution_id: E3JEO5R14CT8IH
- name: Upload sdk-core latest documentation redirect
if: env.PUBLISH_SDK_CORE == 1
uses: ./build-scripts/s3cloudfront-hosting/actions/sync
with:
local_build_dir: sdk-core-redirect
aws_region: eu-west-2
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
s3_uri: ${{ format('{0}sdk-core', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }}
cloudfront_distribution_id: E3JEO5R14CT8IH
- name: Publish sdk-redux package
id: publish-sdk-redux
if: env.PUBLISH_SDK_REDUX == 1
run: |
yarn --cwd packages/ethereum-contracts build
yarn --cwd packages/sdk-core get-graphql-schema:v1
yarn --cwd packages/sdk-core build
yarn --cwd packages/sdk-redux build
tasks/npm-publish.sh packages/sdk-redux/ latest
PUBLISHED_VERSION=$(jq -r .version packages/sdk-redux/package.json)
echo "PUBLISHED_VERSION=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT"
# Build documentation with redirect from root
yarn --cwd packages/sdk-redux doc:html
mkdir sdk-redux-redirect
printf '<!DOCTYPE html><html><head><title>Redirecting...</title><meta charset="UTF-8"><meta http-equiv="refresh" content="0;URL=%s" /><meta http-equiv="Cache-Control" content="no-store" /></head><body><p>Redirecting to latest documentation...</p></body></html>' "https://refs.superfluid.finance/sdk-redux@$PUBLISHED_VERSION" \
> sdk-redux-redirect/index.html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: Upload sdk-redux HTML documentation
if: env.PUBLISH_SDK_REDUX == 1
uses: ./build-scripts/s3cloudfront-hosting/actions/sync
with:
local_build_dir: packages/sdk-redux/dist/docs
aws_region: eu-west-2
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
s3_uri: ${{ format('{0}sdk-redux@{1}', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI, steps.publish-sdk-redux.outputs.PUBLISHED_VERSION) }}
cloudfront_distribution_id: E3JEO5R14CT8IH
- name: Upload sdk-redux latest documentation redirect
if: env.PUBLISH_SDK_REDUX == 1
uses: ./build-scripts/s3cloudfront-hosting/actions/sync
with:
local_build_dir: sdk-redux-redirect
aws_region: eu-west-2
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
s3_uri: ${{ format('{0}sdk-redux', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }}
cloudfront_distribution_id: E3JEO5R14CT8IH