From 75377e9049a2cbbfd2abc5aa31e4929ec3487f3f Mon Sep 17 00:00:00 2001 From: Dave-Barcelo Date: Fri, 5 Jan 2024 09:07:11 -0500 Subject: [PATCH] US852217 - ALKS TFP - Automate CI/CD pipeline with Github Actions working... working... Experimenting with autotagger. Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... update... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... Experimenting with autotagging... experiment. typo... typo... update.. update.. Renamed workflow from check-for-release-tag to check-for-release label. More appropriately named. Renamed workflow from check-for-release-tag to check-for-release label. More appropriately named. Renamed workflow from check-for-release-tag to check-for-release label. More appropriately named. update... updated version of action-release-label. update... update... update... update... update... update... Fixing logic in check for release. Fixing logic in check for release. Fixing logic in check for release. --- .github/workflows/check-for-release-label.yml | 21 +++++ .github/workflows/release-auto.yml | 86 +++++++++++++++++++ .github/workflows/release.yml | 42 --------- .gitignore | 8 +- 4 files changed, 114 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/check-for-release-label.yml create mode 100644 .github/workflows/release-auto.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/check-for-release-label.yml b/.github/workflows/check-for-release-label.yml new file mode 100644 index 00000000..ba2549e4 --- /dev/null +++ b/.github/workflows/check-for-release-label.yml @@ -0,0 +1,21 @@ +name: Check For Release Label + +on: + pull_request: + branches: [ master ] + +jobs: + check_for_release_label: + + runs-on: ubuntu-latest + + steps: + - name: Get release label + uses: actions-ecosystem/action-release-label@v1.2.0 + id: release-label + + - run: echo "Release level is ${{ steps.release-label.outputs.level }}" + + - name: Fail if label does not exist, or skip if release/skip label exists + if: ${{ ( ! contains(github.event.pull_request.labels.*.name, 'release/skip') ) && ( steps.release-label.outputs.level == null ) }} + run: echo "Please label your PR with a release label" && exit 1 \ No newline at end of file diff --git a/.github/workflows/release-auto.yml b/.github/workflows/release-auto.yml new file mode 100644 index 00000000..dd6f2c3f --- /dev/null +++ b/.github/workflows/release-auto.yml @@ -0,0 +1,86 @@ +# This GitHub action can publish assets for release when a tag is created. +# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). +# +# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your +# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` +# secret. If you would rather own your own GPG handling, please fork this action +# or use an alternative one for key handling. +# +# You will need to pass the `--batch` flag to `gpg` in your signing step +# in `goreleaser` to indicate this is being used in a non-interactive mode. +# +name: release-auto2 + +on: + pull_request: + types: [closed] + +jobs: + auto-release: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.merged == true }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Unshallow fetch + run: git fetch --prune --unshallow + + - name: Get release label + uses: actions-ecosystem/action-release-label@v1 + id: release-label + if: ${{ github.event.pull_request.merged == true }} + + - name: Get latest tag + uses: actions-ecosystem/action-get-latest-tag@v1 + id: get-latest-tag + if: ${{ steps.release-label.outputs.level != null }} + + - run: | + echo "Latest tag: ${{ steps.get-latest-tag.outputs.tag }}" + echo "Release level: ${{ steps.release-label.outputs.level }}" + + - name: Bump the version + uses: actions-ecosystem/action-bump-semver@v1 + id: bump-semver + if: ${{ steps.release-label.outputs.level != null }} + with: + current_version: ${{ steps.get-latest-tag.outputs.tag }} + level: ${{ steps.release-label.outputs.level }} + + - run: | + echo "New version: ${{ steps.bump-semver.outputs.new_version }}" + + - name: Push new tag + uses: actions-ecosystem/action-push-tag@v1 + if: ${{ steps.release-label.outputs.level != null }} + with: + tag: ${{ steps.bump-semver.outputs.new_version }} + message: '${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' + + - name: Set up Go + uses: actions/setup-go@v2 + if: ${{ steps.release-label.outputs.level != null }} + with: + go-version: 1.18.x + + - name: Import GPG key + id: import_gpg + uses: paultyng/ghaction-import-gpg@v2.1.0 + if: ${{ steps.release-label.outputs.level != null }} + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + if: ${{ steps.release-label.outputs.level != null }} + with: + version: latest + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 033ce582..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,42 +0,0 @@ -# This GitHub action can publish assets for release when a tag is created. -# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). -# -# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your -# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` -# secret. If you would rather own your own GPG handling, please fork this action -# or use an alternative one for key handling. -# -# You will need to pass the `--batch` flag to `gpg` in your signing step -# in `goreleaser` to indicate this is being used in a non-interactive mode. -# -name: release -on: - push: - tags: - - 'v*' -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Unshallow - run: git fetch --prune --unshallow - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.18.x - - name: Import GPG key - id: import_gpg - uses: paultyng/ghaction-import-gpg@v2.1.0 - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - PASSPHRASE: ${{ secrets.PASSPHRASE }} - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --rm-dist - env: - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d669f417..a5e416a7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,10 @@ glide.lock gpg/ # ignore. For testing we don't want to store a specific provider. -.terraform.lock.hcl \ No newline at end of file +.terraform.lock.hcl + +# Adding to disregard some testing framework standup. - dbarcelo +node_modules/ +package-lock.json +package.json +test.js