Skip to content

Commit ef9aab8

Browse files
Trigger deploy workflow after autoupdate without Firebase token (#1)
* Initial plan * Update CI/CD to trigger deploy after autoupdate without firebase token Co-authored-by: siarheidudko <36571430+siarheidudko@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: siarheidudko <36571430+siarheidudko@users.noreply.github.com>
1 parent ac31069 commit ef9aab8

2 files changed

Lines changed: 38 additions & 54 deletions

File tree

.github/workflows/autoupdate.yml

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ name: Autoupdate
22
on:
33
schedule:
44
- cron: "0 1 * * *"
5+
workflow_dispatch:
6+
workflow_call:
57
concurrency:
68
group: "${{ github.workflow }} @ ${{ github.ref }}"
79
cancel-in-progress: false
10+
permissions:
11+
contents: write
12+
actions: write
813
jobs:
914
update:
1015
env:
@@ -38,58 +43,14 @@ jobs:
3843
builds-and-checks: |
3944
npm test
4045
debug: "true"
41-
release:
46+
deploy:
4247
runs-on: ubuntu-latest
43-
timeout-minutes: 15
44-
env:
45-
NODE_VERSION: 22
46-
VERSION: ${{ needs.update.outputs.version }}
47-
needs: [update]
48-
if: ${{ needs.update.outputs.updated == 'true' }}
48+
needs: update
49+
if: needs.update.outputs.updated == 'true'
4950
steps:
50-
- name: Сheckout repo
51-
id: checkout_repo
52-
uses: actions/checkout@v4
53-
with:
54-
ref: "main"
55-
- name: Use Node.js ${{ env.NODE_VERSION }}
56-
id: setup_node
57-
uses: actions/setup-node@v4
58-
with:
59-
node-version: ${{ env.NODE_VERSION }}
60-
registry-url: "https://registry.npmjs.org"
61-
- name: Cache node modules
62-
id: use_cache
63-
uses: actions/cache@v4
64-
env:
65-
cache-name: cache-node-modules
66-
with:
67-
path: ~/.npm
68-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
69-
restore-keys: |
70-
${{ runner.os }}-build-${{ env.cache-name }}-
71-
${{ runner.os }}-build-
72-
${{ runner.os }}-
73-
- name: Install modules
74-
id: install_modules
75-
run: npm ci
76-
- name: Build tools
77-
id: build_tools
78-
run: npm run build
79-
- name: Create Release
80-
id: create_release
81-
uses: actions/create-release@v1
82-
env:
83-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
- name: Trigger Build and Deploy Workflow
52+
uses: benc-uk/workflow-dispatch@v1
8453
with:
85-
tag_name: ${{ env.VERSION }}
86-
release_name: Release ${{ env.VERSION }}
87-
body: |
88-
see [CHANGELOG.md](https://github.com/siarheidudko/firebase-admin-cli/blob/main/CHANGELOG.md)
89-
draft: false
90-
prerelease: false
91-
- name: Publish package to NPM
92-
id: npm_publish
93-
run: npm publish
94-
env:
95-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54+
workflow: build-and-deploy.yml
55+
ref: main
56+
inputs: '{ "tag": "${{ needs.update.outputs.version }}" }'
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ on:
33
push:
44
tags:
55
- "v*.*.*"
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "Tag version to deploy (e.g., v1.2.3)"
10+
required: true
11+
type: string
12+
workflow_call:
13+
inputs:
14+
tag:
15+
description: "Tag version to deploy"
16+
required: true
17+
type: string
18+
permissions:
19+
id-token: write
20+
contents: write
621
jobs:
722
deploy:
823
runs-on: ubuntu-latest
@@ -32,14 +47,22 @@ jobs:
3247
- name: Build tools
3348
id: build_tools
3449
run: npm run build
50+
- name: Set RELEASE_VERSION env
51+
run: |
52+
if [ -n "${{ inputs.tag }}" ]; then
53+
RELEASE_VERSION="${{ inputs.tag }}"
54+
else
55+
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
56+
fi
57+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
3558
- name: Create Release
3659
id: create_release
3760
uses: actions/create-release@v1
3861
env:
3962
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4063
with:
41-
tag_name: ${{ github.ref }}
42-
release_name: Release ${{ github.ref }}
64+
tag_name: ${{ env.RELEASE_VERSION }}
65+
release_name: Release ${{ env.RELEASE_VERSION }}
4366
body: |
4467
see [CHANGELOG.md](https://github.com/siarheidudko/firebase-admin-cli/blob/main/CHANGELOG.md)
4568
draft: false

0 commit comments

Comments
 (0)