1+ name : release-package
2+ on :
3+ push :
4+ branches :
5+ - release
6+
7+ env :
8+ PROJECT_NAME : template-app
9+ SCOPE : simatic-ax
10+ ACTIONS_REPO : simatic-ax/actions
11+ ACTIONS_LOCAL : ./actions
12+ VERSIONING_TOOL_REPO : simatic-ax/simatic_versioning
13+
14+ jobs :
15+ versioning :
16+ name : " Bump the version of the package according to the conventional commit"
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : " Clone the library repository"
20+ uses : actions/checkout@v3
21+ - name : " Clone repository for CI workflows"
22+ uses : actions/checkout@v3
23+ with :
24+ repository : ${{ env.ACTIONS_REPO }}
25+ token : ${{ secrets.CI_KIT_TOKEN }}
26+ path : ./actions
27+ - name : " Get the latest version of the package"
28+ run : |
29+ echo "@simatic-ax:registry=https://npm.pkg.github.com/" >> .npmrc
30+ echo "//npm.pkg.github.com/:_authToken=${{ secrets.CI_KIT_TOKEN }}" >> .npmrc
31+ echo "always-auth = true" >> .npmrc
32+ cat .npmrc
33+ echo "VERSION=$(npm show @${{ env.SCOPE }}/${{ env.PROJECT_NAME }} version --registry=https://npm.pkg.github.com --scope=${{ env.SCOPE }})" >> $GITHUB_ENV
34+ echo $VERSION
35+ - name : " Check contents of actions folder"
36+ run : tree -d ./actions
37+ - name : " Install apax and dependencies"
38+ uses : ./actions/.github/actions/setup-apax-runner
39+ with :
40+ apax-access-token : ${{ secrets.APAX_TOKEN }}
41+
42+ - name : " Get latest simatic-versioning executable"
43+ uses : dsaltares/fetch-gh-release-asset@master
44+ with :
45+ repo : ${{ env.VERSIONING_TOOL_REPO }}
46+ file : " conventional-commit"
47+ token : ${{ secrets.CI_KIT_TOKEN }}
48+
49+ - id : bump
50+ name : " Bump version"
51+ run : |
52+ apax version ${{ env.VERSION }}
53+ sudo chmod +x ./conventional-commit
54+ ./conventional-commit -c "${{ github.event.head_commit.message }}" -v "${{ env.VERSION }}" >> .version
55+ cat .version
56+ - name : " Upload version"
57+ uses : actions/upload-artifact@v3
58+ with :
59+ name : version
60+ path : .version
61+ release :
62+ name : " Release binary"
63+ runs-on : ubuntu-latest
64+ needs : versioning
65+ steps :
66+ - name : " Clone the library repository"
67+ uses : actions/checkout@v3
68+
69+ - name : " Clone repository for CI workflows"
70+ uses : actions/checkout@v3
71+ with :
72+ repository : simatic-ax/actions
73+ token : ${{ secrets.CI_KIT_TOKEN }}
74+ path : ./actions
75+
76+ - name : " Install apax and dependencies"
77+ uses : ./actions/.github/actions/setup-apax-runner
78+ with :
79+ apax-access-token : ${{ secrets.APAX_TOKEN }}
80+
81+ # - name: "Download artifact"
82+ # uses: actions/download-artifact@v3
83+ # with:
84+ # name: library-artifact
85+
86+ - name : " Login to the private repo"
87+ run : |
88+ apax login \
89+ --registry "https://npm.pkg.github.com" \
90+ --password ${{ secrets.CI_KIT_TOKEN }}
91+ - name : " Download artifact"
92+ uses : actions/download-artifact@v3
93+ with :
94+ name : version
95+
96+ - name : " Pack and publish the library"
97+ run : |
98+ cat .version
99+ apax version "$(cat .version)"
100+ apax pack 2>.package.err 1>.signature
101+ PACKAGE="$(grep -oP '(?<=\").+.apax\.tgz(?=\")' .package.err)"
102+ apax publish --package $PACKAGE --registry https://npm.pkg.github.com
0 commit comments