Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/github-action-release_for_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: release-package
on:
push:
branches:
- release

env:
PROJECT_NAME: snippetscollection
SCOPE: simatic-ax
ACTIONS_REPO: simatic-ax/actions
ACTIONS_LOCAL: ./actions
VERSIONING_TOOL_REPO: simatic-ax/simatic_versioning

jobs:
versioning:
name: "Bump the version of the package according to the conventional commit"
runs-on: ubuntu-latest
steps:
- name: "Clone the library repository"
uses: actions/checkout@v3
- name: "Clone repository for CI workflows"
uses: actions/checkout@v3
with:
repository: ${{ env.ACTIONS_REPO }}
token: ${{ secrets.CI_KIT_TOKEN }}
path: ./actions
- name: "Get the latest version of the package"
run: |
echo "@simatic-ax:registry=https://npm.pkg.github.com/" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.CI_KIT_TOKEN }}" >> .npmrc
echo "always-auth = true" >> .npmrc
cat .npmrc
echo "VERSION=$(npm show @${{ env.SCOPE }}/${{ env.PROJECT_NAME }} version --registry=https://npm.pkg.github.com --scope=${{ env.SCOPE }})" >> $GITHUB_ENV
echo $VERSION
- name: "Check contents of actions folder"
run: tree -d ./actions
- name: "Install apax and dependencies"
uses: ./actions/.github/actions/setup-apax-runner
with:
apax-access-token: ${{ secrets.APAX_TOKEN }}

- name: "Get latest simatic-versioning executable"
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: ${{ env.VERSIONING_TOOL_REPO }}
file: "conventional-commit"
token: ${{ secrets.CI_KIT_TOKEN }}

- id: bump
name: "Bump version"
run: |
apax version ${{ env.VERSION }}
sudo chmod +x ./conventional-commit
./conventional-commit -c "${{ github.event.head_commit.message }}" -v "${{ env.VERSION }}" >> .version
cat .version
- name: "Upload version"
uses: actions/upload-artifact@v3
with:
name: version
path: .version
release:
name: "Release binary"
runs-on: ubuntu-latest
needs: versioning
steps:
- name: "Clone the library repository"
uses: actions/checkout@v3

- name: "Clone repository for CI workflows"
uses: actions/checkout@v3
with:
repository: simatic-ax/actions
token: ${{ secrets.CI_KIT_TOKEN }}
path: ./actions

- name: "Install apax and dependencies"
uses: ./actions/.github/actions/setup-apax-runner
with:
apax-access-token: ${{ secrets.APAX_TOKEN }}

# - name: "Download artifact"
# uses: actions/download-artifact@v3
# with:
# name: library-artifact

- name: "Login to the private repo"
run: |
apax login \
--registry "https://npm.pkg.github.com" \
--password ${{ secrets.CI_KIT_TOKEN }}
- name: "Download artifact"
uses: actions/download-artifact@v3
with:
name: version

- name: "Pack and publish the library"
run: |
cat .version
apax version "$(cat .version)"
apax pack 2>.package.err 1>.signature
PACKAGE="$(grep -oP '(?<=\").+.apax\.tgz(?=\")' .package.err)"
apax publish --package $PACKAGE --registry https://npm.pkg.github.com