-
Notifications
You must be signed in to change notification settings - Fork 17
131 lines (118 loc) · 4.01 KB
/
release.yml
File metadata and controls
131 lines (118 loc) · 4.01 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
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
permissions:
id-token: write # Required for OIDC
contents: write
actions: write
jobs:
build-publish:
name: Build & publish
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- 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: Install
run: yarn install --immutable
- name: Build
run: yarn build
- name: Update npm
run: npm install -g npm@latest
- name: Release
run: npm publish --tag ${{ github.event.inputs.tag }} --access public
- name: Get version
id: package-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.package-version.outputs.version }}
name: v${{ steps.package-version.outputs.version }}
generate_release_notes: true
prerelease: ${{ github.event.inputs.tag != 'latest' }}
# - 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/github-tagger@v0.0.1
# 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: 'github-actions@github.com'
# target-branch: master
# commit-message: 'release: v${{ steps.package-version.outputs.current-version }}'