Skip to content

;workflows: release: create release, upload latest binaries #51

;workflows: release: create release, upload latest binaries

;workflows: release: create release, upload latest binaries #51

Workflow file for this run

# Run when a release tag is pushed, creating/updating a draft release.
# Expects that the main binaries* workflows have been completed first.
name: release
on:
push:
tags:
- '1.*'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get artifact from latest successful binaries-windows-x64 run
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe
# https://github.com/dawidd6/action-download-artifact v3.1.4, unverified so needs to be whitelisted in repo settings
with:
# Optional, GitHub token, a Personal Access Token with `public_repo` scope if needed
# Required, if the artifact is from a different repo
# Required, if the repo is private a Personal Access Token with `repo` scope is needed or GitHub token in a job where the permissions `action` scope set to `read`
# github_token: ${{secrets.GITHUB_TOKEN}}
# Optional, workflow file name or ID
# If not specified, will be inferred from run_id (if run_id is specified), or will be the current workflow
workflow: binaries-windows-x64.yml
# Optional, will use specified workflow run
# use ${{ github.event.workflow_run.id }} when your action runs in a workflow_run event
# and wants to download from the triggering workflow run
# run_id: 1122334455
# If no workflow is set and workflow_search set to true, then the most recent workflow matching
# all other criteria will be looked up instead of using the current workflow
workflow_search: false
# Optional, the status or conclusion of a completed workflow to search for
# Can be one of a workflow conclusion:
# "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required"
# Or a workflow status:
# "completed", "in_progress", "queued"
# Use the empty string ("") to ignore status or conclusion in the search
workflow_conclusion: success
# Optional, will get head commit SHA
# pr: ${{github.event.pull_request.number}}
# Optional, no need to specify if PR is
# commit: ${{github.event.pull_request.head.sha}}
# Optional, will use the specified branch. Defaults to all branches
# branch: binaries-linux-x64
# Optional, defaults to all types
# event: push
# Optional, run number from the workflow
# run_number: 34
# Optional, uploaded artifact name,
# will download all artifacts if not specified
# and extract them into respective subdirectories
# https://github.com/actions/download-artifact#download-all-artifacts
# is treated as a regular expression if input name_is_regexp is true
# will download only those artifacts with a name that matches this regular expression
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
# name: artifact_name
# Optional, name is treated as a regular expression if set true
# name_is_regexp: true
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: artifacts
# Optional, defaults to current repo
# repo: ${{ github.repository }}
# Optional, check the workflow run to whether it has an artifact
# then will get the last available artifact from the previous workflow
# default false, just try to download from the last one
# check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
# search_artifacts: false
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# windows artifact is just zipped, no need to repack
skip_unpack: true
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
# if_no_artifact_found: fail
# Optional, allow forks when searching for artifacts
# default true
allow_forks: false
- name: Get artifact from latest successful binaries-linux-x64 run
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe
with:
workflow: binaries-linux-x64.yml
allow_forks: false
path: artifacts
- name: Get artifact from latest successful binaries-mac-x64 run
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe
with:
workflow: binaries-mac-x64.yml
allow_forks: false
path: artifacts
- name: Get artifact from latest successful binaries-mac-arm64 run
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe
with:
workflow: binaries-mac-arm64.yml
allow_forks: false
path: artifacts
- name: Inspect artifacts
shell: bash
run: |
ls -lRFh artifacts
# All artifacts are zip files because upload-artifact always zips.
# Here we can switch to more unix-standard gz.
- name: Repack unix artifacts with gz
shell: bash
run: |
cd artifacts
mv */*.tar .
gzip *.tar
- name: Inspect artifacts
shell: bash
run: |
ls -lRFh artifacts
- name: Create release
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # https://github.com/softprops/action-gh-release 2.0.5
# permissions:
# contents: write
with:
# https://github.com/softprops/action-gh-release?tab=readme-ov-file#-customizing
# body String Text communicating notable changes in this release
# body_path String Path to load text communicating notable changes in this release
# draft Boolean Indicator of whether or not this release is a draft
# prerelease Boolean Indicator of whether or not is a prerelease
# files String Newline-delimited globs of paths to assets to upload for release
# name String Name of the release. defaults to tag name
# tag_name String Name of a tag. defaults to github.ref
# fail_on_unmatched_files Boolean Indicator of whether to fail if any of the files globs match nothing
# repository String Name of a target repository in <owner>/<repo> format. Defaults to GITHUB_REPOSITORY env variable
# target_commitish String Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Defaults to repository default branch.
# token String Secret GitHub Personal Access Token. Defaults to ${{ github.token }}
# discussion_category_name String If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see "Managing categories for discussions in your repository."
# generate_release_notes Boolean Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise, a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes. See the GitHub docs for this feature for more information
# append_body Boolean Append to existing body instead of overwriting it
# make_latest String Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Can be true, false, or legacy. Uses GitHub api defaults if not provided
#
draft: true
body_path: ${{ github.workspace }}/doc/relnotes.github.md
fail_on_unmatched_files: true
files: |
artifacts/hledger-windows-x64.zip
artifacts/hledger-linux-x64.tar.gz
artifacts/hledger-mac-x64.tar.gz
artifacts/hledger-mac-arm64.tar.gz
# snippets
# body: |
# ${{ fromJSON(steps.<step-id>.outputs.assets)[0].browser_download_url }}
# if you intend to run workflows on the release event (on: { release: { types: [published] } }),
# you need to use a personal access token for this action, as the default secrets.GITHUB_TOKEN does not trigger another workflow.
# - name: Make tarball
# shell: bash
# run: |
# outdir="target/${{ matrix.target }}/release"
# staging="jj-${{ github.event.release.tag_name }}-${{ matrix.target }}"
# mkdir "$staging"
# cp {README.md,LICENSE} "$staging/"
# if [ "${{ matrix.os }}" = "windows-2022" ]; then
# cp "$outdir/jj.exe" "$staging/"
# cd "$staging"
# 7z a "../$staging.zip" .
# echo "ASSET=$staging.zip" >> $GITHUB_ENV
# else
# cp "$outdir/jj" "$staging/"
# tar czf "$staging.tar.gz" -C "$staging" .
# echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
# fi
# https://github.com/marketplace/actions/safe-download-workflow-artifact
# https://github.com/actions/upload-artifact/issues/89#issuecomment-1194408215
# https://www.eliostruyf.com/retrieving-artifact-previous-github-actions-workflow/
# We have two workflows, one for building and one for releasing built artifacts upon a tag release.
# They're both summoned from one push event, and the release job waits for the other job:
# https://github.com/dawidd6/action-download-artifact/issues/245
# - name: version
# run: echo "::set-output name=version::$(./bin/azblogfilter --version)"
# id: version
# - name: release
# uses: actions/create-release@v1
# id: create_release
# with:
# draft: false
# prerelease: false
# release_name: ${{ steps.version.outputs.version }}
# tag_name: ${{ github.ref }}
# body_path: CHANGELOG.md
# env:
# GITHUB_TOKEN: ${{ github.token }}