From 7703f45d8729c2c70be5d4142fe7e78960964b6c Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Tue, 28 Nov 2023 18:52:46 -0500 Subject: [PATCH] ci: combine workflows --- .github/workflows/tag-and-release.yml | 52 -------------------------- .github/workflows/test-and-publish.yml | 49 ++++++++++++++++++++---- 2 files changed, 42 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/tag-and-release.yml diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml deleted file mode 100644 index 35bacc7..0000000 --- a/.github/workflows/tag-and-release.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: 🔖 Tag and Release - -on: - workflow_dispatch: - inputs: - # See https://github.com/hyper63/hyper-ci-bump#inputs for available inputs for the bump action - version: - description: the semver version to bump to - required: true - -jobs: - release: - runs-on: ubuntu-latest - steps: - - - name: ⬇️ Checkout repo - uses: actions/checkout@v3 - with: - # Allows for pushes from this workflow to trigger subsequent workflows - token: ${{ secrets.CI_GITHUB_TOKEN }} - fetch-depth: 0 - - - name: ⎔ Setup node - uses: actions/setup-node@v3 - with: - node-version: 18.x - - - name: 🤓 Set Git User - run: | - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - - - name: ✊ Bump - id: bump - uses: hyper63/hyper-ci-bump@main - with: - bump-to: ${{ github.event.inputs.version }} - package: ${{ github.event.inputs.package }} - prefix: ${{ github.event.inputs.prefix }} - runtime: ${{ github.event.inputs.runtime }} - - - name: ⬆️ Push - run: | - git push --follow-tags - - - name: 🤖 Create Github Release - if: steps.bump.outputs.tag - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ steps.bump.outputs.tag }} - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index 8ea3cc0..3108294 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -7,8 +7,14 @@ on: push: branches: - main - tags: - - '*' + + # Perform a release using a workflow dispatch + workflow_dispatch: + inputs: + # See https://github.com/hyper63/hyper-ci-bump#inputs for available inputs for the bump action + version: + description: the semver version to bump to + required: true jobs: test: @@ -91,14 +97,43 @@ jobs: MONGO_URL: ${{ secrets.INTEGRATION_ATLAS_MONGO_URL }} publish: - if: startsWith(github.ref, 'refs/tags/v') - needs: [test, test-native-integration-self-hosted, test-native-integration-atlas] + # Releases are performed via a workflow dispatch + if: github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest + needs: [test, test-native-integration-self-hosted, test-native-integration-atlas] steps: - name: ⬇️ Checkout repo uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: 👀 Env + run: | + echo "Event name: ${{ github.event_name }}" + echo "Git ref: ${{ github.ref }}" + echo "GH actor: ${{ github.actor }}" + echo "SHA: ${{ github.sha }}" + VER=`node --version`; echo "Node ver: $VER" + VER=`npm --version`; echo "npm ver: $VER" - - name: 🦕 Setup Deno - uses: denoland/setup-deno@v1 + - name: 🤓 Set Git User + run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + - name: ✊ Bump + id: bump + uses: hyper63/hyper-ci-bump@main + with: + bump-to: ${{ github.event.inputs.version }} + + - name: ⬆️ Push + run: | + git push + git push --tags + + - name: 🤖 Create Github Release + if: steps.bump.outputs.tag + uses: softprops/action-gh-release@v1 with: - deno-version: 1.x + tag_name: ${{ steps.bump.outputs.tag }}