From 493b6bc3e27c889f6a2519de01863bdafbf77143 Mon Sep 17 00:00:00 2001 From: Felix Krueger Date: Fri, 24 Jun 2022 13:05:34 +0200 Subject: [PATCH] feat(ci): added github actions to the repository from the example repository --- .github/workflows/github-action-release.yml | 135 ++++++++++++++++++ .github/workflows/github-action-test-apax.yml | 55 +++++++ 2 files changed, 190 insertions(+) create mode 100644 .github/workflows/github-action-release.yml create mode 100644 .github/workflows/github-action-test-apax.yml diff --git a/.github/workflows/github-action-release.yml b/.github/workflows/github-action-release.yml new file mode 100644 index 0000000..80a8a84 --- /dev/null +++ b/.github/workflows/github-action-release.yml @@ -0,0 +1,135 @@ +on: + push: + branches: + - release + +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: kruegerfelix/ax_ci_workflows + token: ${{ secrets.CI_KIT_TOKEN }} + path: ax_ci_workflows + - name: "Install apax and dependencies" + uses: ./ax_ci_workflows/.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: "simatic-ax/simatic_versioning" + file: "conventional-commit" + token: ${{ secrets.CI_KIT_TOKEN }} + - name: "Bump version" + run: | + ls -a + pwd + sudo chmod +x ./conventional-commit + sudo ./conventional-commit \ + --commit-message "${{ github.event.head_commit.message }}" \ + --path . \ + --update \ + + build: + name: "Build apax library" + 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: kruegerfelix/ax_ci_workflows + token: ${{ secrets.CI_KIT_TOKEN }} + path: ax_ci_workflows + - name: "Install apax and dependencies" + uses: ./ax_ci_workflows/.github/actions/setup-apax-runner + with: + apax-access-token: ${{ secrets.APAX_TOKEN }} + + - name: "Build apax library" + uses: ./ax_ci_workflows/.github/actions/build-apax-package + with: + library-directory: ${{ github.workspace }} + apax-access-token: ${{ secrets.APAX_TOKEN }} + + - name: "Upload artifact" + uses: actions/upload-artifact@v3 + with: + name: library-artifact + path: bin/ + + test: + name: "Test apax library" + runs-on: ubuntu-latest + needs: build + steps: + - name: "Clone the library repository" + uses: actions/checkout@v3 + + - name: "Clone repository for CI workflows" + uses: actions/checkout@v3 + with: + repository: kruegerfelix/ax_ci_workflows + token: ${{ secrets.CI_KIT_TOKEN }} + path: ax_ci_workflows + + - name: "Install apax and dependencies" + uses: ./ax_ci_workflows/.github/actions/setup-apax-runner + with: + apax-access-token: ${{ secrets.APAX_TOKEN }} + + - name: "Build apax library" + uses: ./ax_ci_workflows/.github/actions/build-apax-package + with: + library-directory: ${{ github.workspace }} + apax-access-token: ${{ secrets.APAX_TOKEN }} + + - name: "Test apax package" + run: apax test + + release: + name: "Release binary" + runs-on: ubuntu-latest + needs: test + steps: + - name: "Clone the library repository" + uses: actions/checkout@v3 + + - name: "Clone repository for CI workflows" + uses: actions/checkout@v3 + with: + repository: kruegerfelix/ax_ci_workflows + token: ${{ secrets.CI_KIT_TOKEN }} + path: ax_ci_workflows + + - name: "Install apax and dependencies" + uses: ./ax_ci_workflows/.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: "Pack and publish the library" + run: | + apax pack 2>.package.err 1>.signature + PACKAGE="$(grep -oP '(?<=\").+.apax\.tgz(?=\")' .package.err)" + apax publish --package $PACKAGE --registry https://npm.pkg.github.com diff --git a/.github/workflows/github-action-test-apax.yml b/.github/workflows/github-action-test-apax.yml new file mode 100644 index 0000000..af9e016 --- /dev/null +++ b/.github/workflows/github-action-test-apax.yml @@ -0,0 +1,55 @@ +name: test-apax +on: + workflow_dispatch: + +jobs: + build: + name: "Build apax library" + 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: kruegerfelix/ax_ci_workflows + token: ${{ secrets.CI_KIT_TOKEN }} + path: ax_ci_workflows + - name: "Install apax and dependencies" + uses: ./ax_ci_workflows/.github/actions/setup-apax-runner + with: + apax-access-token: ${{ secrets.APAX_TOKEN }} + + - name: "Build apax library" + uses: ./ax_ci_workflows/.github/actions/build-apax-package + with: + library-directory: ${{ github.workspace }} + apax-access-token: ${{ secrets.APAX_TOKEN }} + + test: + name: "Test apax library" + runs-on: ubuntu-latest + needs: build + steps: + - name: "Clone the library repository" + uses: actions/checkout@v3 + + - name: "Clone repository for CI workflows" + uses: actions/checkout@v3 + with: + repository: kruegerfelix/ax_ci_workflows + token: ${{ secrets.CI_KIT_TOKEN }} + path: ax_ci_workflows + + - name: "Install apax and dependencies" + uses: ./ax_ci_workflows/.github/actions/setup-apax-runner + with: + apax-access-token: ${{ secrets.APAX_TOKEN }} + + - name: "Build apax library" + uses: ./ax_ci_workflows/.github/actions/test-apax-package + with: + library-directory: ${{ github.workspace }} + apax-access-token: ${{ secrets.APAX_TOKEN }}