From 99e8a36bb581ac84619ecba452c5afa3d56dae94 Mon Sep 17 00:00:00 2001 From: ab77 Date: Thu, 17 Nov 2022 15:06:37 -0800 Subject: [PATCH] Move GH publishing to FZ core Change-type: patch --- .github/actions/always/action.yml | 38 ------------------ .github/actions/finalize/action.yml | 62 ----------------------------- .github/actions/publish/action.yml | 28 ++----------- .github/actions/test/action.yml | 13 ------ 4 files changed, 3 insertions(+), 138 deletions(-) delete mode 100644 .github/actions/always/action.yml delete mode 100644 .github/actions/finalize/action.yml diff --git a/.github/actions/always/action.yml b/.github/actions/always/action.yml deleted file mode 100644 index a5bf5b9f..00000000 --- a/.github/actions/always/action.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: cleanup -# https://github.com/product-os/flowzone/tree/master/.github/actions -inputs: - json: - description: "JSON stringified object containing all the inputs from the calling workflow" - required: true - secrets: - description: "JSON stringified object containing all the secrets from the calling workflow" - required: true - - # --- custom environment - VERBOSE: - type: string - default: "true" - -runs: - # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action - using: "composite" - steps: - # delete draft releases if the pull request is closed without merging - - name: Delete draft release - if: | - runner.os == 'Linux' && - github.event_name == 'pull_request' && - github.event.pull_request.merged == false && - github.event.action == 'closed' - - shell: bash - run: | - set -ea - - [[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x - - gh release delete --yes '${{ github.event.pull_request.head.ref }}' || true - - env: - GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }} diff --git a/.github/actions/finalize/action.yml b/.github/actions/finalize/action.yml deleted file mode 100644 index fdf3511f..00000000 --- a/.github/actions/finalize/action.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -name: publish GitHub release -# https://github.com/product-os/flowzone/tree/master/.github/actions -inputs: - json: - description: "JSON stringified object containing all the inputs from the calling workflow" - required: true - secrets: - description: "JSON stringified object containing all the secrets from the calling workflow" - required: true - - # --- custom environment - VERBOSE: - type: string - default: "true" - -runs: - # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action - using: "composite" - steps: - - name: Get release version - if: runner.os == 'Linux' - id: get_release - shell: bash - run: | - set -ea - - [[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x - - echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT - - # https://docs.github.com/en/rest/releases - - name: Finalize GitHub release - if: runner.os == 'Linux' - shell: bash - run: | - set -ea - - [[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x - - # prevent git from existing with 141 - set +o pipefail - - previous_tag="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)" - release_notes="$(git log ${previous_tag}..HEAD --pretty=reference)" - - gh release edit '${{ github.event.pull_request.head.ref }}' \ - --notes "${release_notes}" \ - --title 'v${{ steps.get_release.outputs.version }}' \ - --tag 'v${{ steps.get_release.outputs.version }}' \ - --prerelease=false \ - --draft=false - - release_id="$(gh api "/repos/${{ github.repository }}/releases/tags/v${{ steps.get_release.outputs.version }}" \ - -H 'Accept: application/vnd.github+json' | jq -r .id)" - - gh api --method PATCH "/repos/${{ github.repository }}/releases/${release_id}" \ - -H 'Accept: application/vnd.github+json' \ - -F make_latest="true" - - env: - GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }} diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index a428f07e..16cc0a4e 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -83,7 +83,6 @@ runs: # https://github.com/product-os/scripts/tree/master/shared # https://github.com/product-os/balena-concourse/blob/master/pipelines/github-events/template.yml - name: Package release - id: package_release shell: bash run: | set -ea @@ -114,8 +113,6 @@ runs: find dist -type f -maxdepth 1 - echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT - env: # https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/#improvements-for-public-repository-forks # https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks#about-workflow-runs-from-public-forks @@ -126,28 +123,9 @@ runs: XCODE_APP_LOADER_EMAIL: ${{ inputs.XCODE_APP_LOADER_EMAIL }} XCODE_APP_LOADER_PASSWORD: ${{ fromJSON(inputs.secrets).XCODE_APP_LOADER_PASSWORD }} - # https://github.com/softprops/action-gh-release#-customizing - - name: Create draft GitHub (pre)release - uses: softprops/action-gh-release@v1 - with: - # use PR branch name for draft releases - name: ${{ github.event.pull_request.head.ref }} - tag_name: ${{ github.event.pull_request.head.ref }} - draft: true - prerelease: true - token: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }} - files: | - dist/*.pkg - dist/*.exe - dist/*.zip - - - name: Compress custom source - shell: pwsh - run: tar -acf ${{ runner.temp }}/custom.tgz . - - - name: Upload custom artifact + - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }} - path: ${{ runner.temp }}/custom.tgz + name: gh-release-${{ github.event.pull_request.head.sha || github.event.head_commit.id }} + path: dist retention-days: 1 diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index fe5ffd1a..d25cf2e5 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -22,19 +22,6 @@ runs: # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action using: "composite" steps: - - name: Delete previous draft release - if: runner.os == 'Linux' - shell: bash - run: | - set -ea - - [[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x - - gh release delete --yes '${{ github.event.pull_request.head.ref }}' || true - - env: - GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }} - # https://github.com/actions/setup-node#caching-global-packages-data - name: Setup Node.js uses: actions/setup-node@v3