From dd40aff0fc2e466d8ae3831600110a446101fc33 Mon Sep 17 00:00:00 2001 From: Felix Krueger Date: Mon, 9 Jan 2023 10:44:38 +0100 Subject: [PATCH] feat(ci): Added reference to reusable workflows in actions repository --- .github/workflows/build-library.yml | 18 ++ .github/workflows/github-action-release.yml | 178 ------------------ .github/workflows/github-action-test-apax.yml | 80 -------- .github/workflows/lint-repo.yml | 4 + .github/workflows/lint.yml | 19 -- .github/workflows/release-library.yml | 15 ++ .markdownlint copy.yml | 14 ++ .markdownlint.yml | 5 +- repolinter.json | 21 +++ 9 files changed, 76 insertions(+), 278 deletions(-) create mode 100644 .github/workflows/build-library.yml delete mode 100644 .github/workflows/github-action-release.yml delete mode 100644 .github/workflows/github-action-test-apax.yml create mode 100644 .github/workflows/lint-repo.yml delete mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release-library.yml create mode 100644 .markdownlint copy.yml create mode 100644 repolinter.json diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml new file mode 100644 index 0000000..7975d79 --- /dev/null +++ b/.github/workflows/build-library.yml @@ -0,0 +1,18 @@ +on: push + +jobs: + build-apax-lib: + uses: simatic-ax/actions/.github/workflows/apax-build.yml@stable + secrets: + APAX_TOKEN: ${{ secrets.APAX_TOKEN }} + with: + ACTIONS_REF: stable + LOGIN_SIMATIC_AX: true + + test-apax-lib: + needs: build-apax-lib + uses: simatic-ax/actions/.github/workflows/apax-build-test.yml@stable + secrets: + APAX_TOKEN: ${{ secrets.APAX_TOKEN }} + with: + LOGIN_SIMATIC_AX: true \ No newline at end of file diff --git a/.github/workflows/github-action-release.yml b/.github/workflows/github-action-release.yml deleted file mode 100644 index 5eba24a..0000000 --- a/.github/workflows/github-action-release.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: release-package -on: - push: - branches: - - release - -env: - PROJECT_NAME: io - 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 - - 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: ${{ env.ACTIONS_REPO }} - 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: "Login to the private repo" - run: | - apax login \ - --registry "https://npm.pkg.github.com" \ - --password ${{ secrets.CI_KIT_TOKEN }} - - - name: "Build apax library" - uses: ./actions/.github/actions/apax-build - 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: 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: "Login to the private repo" - run: | - apax login \ - --registry "https://npm.pkg.github.com" \ - --password ${{ secrets.CI_KIT_TOKEN }} - - - name: "Build apax library" - uses: ./actions/.github/actions/apax-test - 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: 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 diff --git a/.github/workflows/github-action-test-apax.yml b/.github/workflows/github-action-test-apax.yml deleted file mode 100644 index 1814da0..0000000 --- a/.github/workflows/github-action-test-apax.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: test-apax -on: - push: - branches: - - '*' - - '!release' -env: - ACTIONS_REPO: simatic-ax/actions - VERSIONING_TOOL_REPO: simatic-ax/simatic_versioning - -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: ${{ env.ACTIONS_REPO }} - token: ${{ secrets.CI_KIT_TOKEN }} - path: actions - - - 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: "Login to the private repo" - run: | - apax login \ - --registry "https://npm.pkg.github.com" \ - --password ${{ secrets.CI_KIT_TOKEN }} - - - name: "Build apax library" - uses: ./actions/.github/actions/apax-build - 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: ${{ env.ACTIONS_REPO }} - 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: "Login to the private repo" - run: | - apax login \ - --registry "https://npm.pkg.github.com" \ - --password ${{ secrets.CI_KIT_TOKEN }} - - - name: "Install workspace dependencies and test" - uses: ./actions/.github/actions/apax-test - with: - apax-access-token: ${{ secrets.APAX_TOKEN }} diff --git a/.github/workflows/lint-repo.yml b/.github/workflows/lint-repo.yml new file mode 100644 index 0000000..9863aa7 --- /dev/null +++ b/.github/workflows/lint-repo.yml @@ -0,0 +1,4 @@ +on: push +jobs: + lint-repo-and-markdown: + uses: simatic-ax/actions/.github/workflows/check-repository.yml@stable diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 7796d00..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: linter checks -on: - push: - -jobs: - linter: - name: "Linter Checks" - runs-on: ubuntu-latest - - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Check markdown files - uses: avto-dev/markdown-lint@v1 - with: - args: '**/*.md' - ignore: ./LICENSE.md diff --git a/.github/workflows/release-library.yml b/.github/workflows/release-library.yml new file mode 100644 index 0000000..c516032 --- /dev/null +++ b/.github/workflows/release-library.yml @@ -0,0 +1,15 @@ +on: + push: + # Pattern matched against refs/tags + tags: + - '*' + +jobs: + release-apax-lib: + uses: simatic-ax/actions/.github/workflows/apax-publish.yml@stable + secrets: + APAX_TOKEN: ${{ secrets.APAX_TOKEN }} + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + + with: + VERSION: ${{ github.ref_name }} diff --git a/.markdownlint copy.yml b/.markdownlint copy.yml new file mode 100644 index 0000000..62620c9 --- /dev/null +++ b/.markdownlint copy.yml @@ -0,0 +1,14 @@ +# markdownlint YAML configuration +--- + +# Default state for all rules +default: true + +# ignored rules +line-length: false +no-inline-html: false +first-line-h1: false +no-emphasis-as-header: false +MD024: + allow_different_nesting: true + siblings_only: true \ No newline at end of file diff --git a/.markdownlint.yml b/.markdownlint.yml index 95479c5..62620c9 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -8,4 +8,7 @@ default: true line-length: false no-inline-html: false first-line-h1: false -no-emphasis-as-header: false \ No newline at end of file +no-emphasis-as-header: false +MD024: + allow_different_nesting: true + siblings_only: true \ No newline at end of file diff --git a/repolinter.json b/repolinter.json new file mode 100644 index 0000000..f662361 --- /dev/null +++ b/repolinter.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/todogroup/repolinter/master/rulesets/schema.json", + "version": 2, + "axioms": { + "linguist": "language", + "licensee": "license", + "packagers": "packager" + }, + "rules": { + "license-file-exists": { + "level": "off", + "rule": { + "type": "file-existence", + "options": { + "globsAny": ["LICENSE*", "COPYING*"], + "nocase": true + } + } + } + } +} \ No newline at end of file