mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-20 06:07:55 +00:00
Move GH publishing to FZ core
Change-type: patch
This commit is contained in:
parent
669cbe227f
commit
99e8a36bb5
38
.github/actions/always/action.yml
vendored
38
.github/actions/always/action.yml
vendored
@ -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 }}
|
62
.github/actions/finalize/action.yml
vendored
62
.github/actions/finalize/action.yml
vendored
@ -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 }}
|
28
.github/actions/publish/action.yml
vendored
28
.github/actions/publish/action.yml
vendored
@ -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
|
||||
|
13
.github/actions/test/action.yml
vendored
13
.github/actions/test/action.yml
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user