forked from Azure/bicep-registry-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (56 loc) · 1.98 KB
/
on-push-main.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
name: On push main
on:
push:
branches:
- main
jobs:
get-module-to-publish:
uses: ./.github/workflows/get-changed-module.yml
create-tag:
runs-on: ubuntu-latest
needs: get-module-to-publish
if: ${{ needs.get-module-to-publish.outputs.module_dir }}
outputs:
tag: ${{ steps.create-tag.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install semver
run: npm install semver
- name: Get base and head versions
id: get-versions
env:
PublicRelease: true
run: |
echo ::set-output name=base_version::$(nbgv get-version ${{ github.event.before }} --format json | jq '.SemVer2')
echo ::set-output name=head_version::$(nbgv get-version ${{ github.event.after }} --format json | jq '.SemVer2')
working-directory: ${{ needs.get-module-to-publish.outputs.module_dir }}
- name: Create tag
id: create-tag
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const script = require("./scripts/github-actions/create-tag.js")
return await script({
require,
github,
context,
core,
moduleDir: "${{ needs.get-module-to-publish.outputs.module_dir }}",
baseVersion: ${{ steps.get-versions.outputs.base_version }},
headVersion: ${{ steps.get-versions.outputs.head_version }},
})
publish-module:
needs: create-tag
if: needs.create-tag.outputs.tag
uses: ./.github/workflows/publish-module.yml
with:
tag: ${{ needs.create-tag.outputs.tag }}
secrets:
PUBLISH_CLIENT_ID: ${{ secrets.PUBLISH_CLIENT_ID }}
PUBLISH_TENANT_ID: ${{ secrets.PUBLISH_TENANT_ID }}
PUBLISH_SUBSCRIPTION_ID: ${{ secrets.PUBLISH_SUBSCRIPTION_ID }}
PUBLISH_REGISTRY_SERVER: ${{ secrets.PUBLISH_REGISTRY_SERVER }}