Skip to content

Commit a75dfb8

Browse files
authored
Added Manual workflow to trigger publish (#378)
* Added manual workflow to publish * Updated workflow name
1 parent 757de6e commit a75dfb8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/manual-publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Manual Publish Release
16+
17+
on:
18+
workflow_dispatch:
19+
20+
jobs:
21+
release:
22+
name: Publish Release
23+
runs-on: ubuntu-latest
24+
permissions: write-all
25+
steps:
26+
- name: Checkout Repo
27+
uses: actions/checkout@master
28+
with:
29+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
30+
fetch-depth: 0
31+
32+
- name: Setup Node.js 18
33+
uses: actions/setup-node@master
34+
with:
35+
node-version: 18
36+
37+
- name: Install Dependencies & build
38+
run: npm install && npm run build
39+
40+
- name: Create .npmrc
41+
run: |
42+
cat << EOF > "$HOME/.npmrc"
43+
@google:registry=https://wombat-dressing-room.appspot.com
44+
//wombat-dressing-room.appspot.com/:_authToken=$NPM_TOKEN
45+
EOF
46+
env:
47+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
49+
- name: Set up user info for git committing
50+
run: |
51+
git config --global user.name "github-actions[bot]"
52+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
53+
54+
- name: NPM publish
55+
run: npx @changesets/cli publish
56+
57+
- name: Git tags
58+
# list tags then try to push them
59+
run: |
60+
git for-each-ref refs/tags
61+
git push --follow-tags
62+
63+
- name: Create Github release
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
NEWEST_TAG=$(git describe --tags --abbrev=0)
68+
gh release create "$NEWEST_TAG" \
69+
--repo="$GITHUB_REPOSITORY" \
70+
--title="$NEWEST_TAG" \
71+
--generate-notes \
72+
--verify-tag

0 commit comments

Comments
 (0)