-
Notifications
You must be signed in to change notification settings - Fork 16
121 lines (109 loc) · 3.63 KB
/
release.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
name: Release
on:
workflow_dispatch:
inputs:
tag:
type: choice
description: Tag
required: true
options:
- beta
- latest
- alpha
# pull_request:
# branches:
# - develop
# paths:
# - .github/workflows/release.yaml
# - src/**
# - bin/**
# - yarn.lock
jobs:
build-publish:
name: Build & publish
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Yarn
run: corepack enable
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Write npm credentials
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> .npmrc
npm whoami
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build
- name: Release
run: npm publish --tag ${{ github.event.inputs.tag }} --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# - name: Build packages
# run: |
# yarn pkg:build
# yarn pkg:compress
#
# - name: Get version
# id: package-version
# uses: martinbeentjes/npm-get-version-action@main
#
# - name: Tag release
# uses: tvdias/[email protected]
# with:
# repo-token: ${{ github.token }}
# tag: v${{ steps.package-version.outputs.current-version }}
#
# - name: Create release page
# uses: softprops/action-gh-release@v1
# with:
# files: 'package/*'
# tag_name: v${{ steps.package-version.outputs.current-version }}
#
# - name: Checkout subsquid/homebrew-cli
# uses: actions/checkout@v3
# with:
# repository: subsquid/homebrew-cli
# path: homebrew-cli
# token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
#
# - name: Gen Formula
# run: |
# echo pkg_macos_shasum=$(shasum -a256 ./package/subsquid-cli-$npm_package_version-macos-x64.tar.gz | cut -f 1 -d " ") >> $GITHUB_ENV
# echo pkg_linux_shasum=$(shasum -a256 ./package/subsquid-cli-$npm_package_version-linux-x64.tar.gz | cut -f 1 -d " ") >> $GITHUB_ENV
# source ./homebrew-cli/gen-formula.sh
# cp sqd@$npm_package_version.rb ./homebrew-cli/Formula
# cp sqd@$version_tag.rb ./homebrew-cli/Formula
# if [ "$version_tag" = "latest" ]; then cp sqd.rb ./homebrew-cli/Formula; fi
# env:
# npm_package_version: ${{ steps.package-version.outputs.current-version }}
# version_tag: ${{ github.event.inputs.tag }}
#
# - name: Pushes to another repository
# uses: cpina/github-action-push-to-another-repository@main
# env:
# API_TOKEN_GITHUB: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
# with:
# source-directory: 'homebrew-cli'
# destination-github-username: 'subsquid'
# destination-repository-name: 'homebrew-cli'
# user-name: 'github-actions'
# user-email: '[email protected]'
# target-branch: master
# commit-message: 'release: v${{ steps.package-version.outputs.current-version }}'