Skip to content

Commit

Permalink
feat: move github release flow out of stacks-core repo
Browse files Browse the repository at this point in the history
  • Loading branch information
BowTiedDevOps committed Nov 13, 2024
1 parent a10cf38 commit bac1b87
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 313 deletions.
38 changes: 11 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,47 +73,31 @@ jobs:
steps:
- name: Check Release
id: check_release
uses: stacks-network/actions/stacks-core/check-release@feat/release-signer-alongside-node
uses: stacks-network/actions/stacks-core/release/check-release@feat/release-signer-alongside-node
with:
tag: ${{ github.ref_name }}

######################################################################################
## Create a tagged github node release
## Create a tagged github release
##
## Runs when:
## - it is a release run
create-node-release:
if: |
needs.check-release.outputs.is_node_release == 'true'
name: Create Node Release
needs:
- rustfmt
- check-release
uses: ./.github/workflows/github-release.yml
with:
tag: ${{ needs.check-release.outputs.node_tag }}
docker_tag: ${{ needs.check-release.outputs.node_docker_tag }}
cache_available: 'false'
secrets: inherit

######################################################################################
## Create a tagged github signer release
##
## Runs when:
## - it is a release run
create-signer-release:
create-release:
if: |
needs.check-release.outputs.is_node_release == 'true' ||
needs.check-release.outputs.is_signer_release == 'true'
name: Create Signer Release
name: Create Node Release
needs:
- rustfmt
- check-release
uses: ./.github/workflows/github-release.yml
with:
tag: ${{ needs.check-release.outputs.signer_tag }}
docker_tag: ${{ needs.check-release.outputs.signer_docker_tag }}
cache_available: ${{ needs.check-release.outputs.is_node_release }}
cache_pattern: ${{ needs.check-release.outputs.node_tag }}
node_tag: ${{ needs.check-release.outputs.node_tag }}
node_docker_tag: ${{ needs.check-release.outputs.node_docker_tag }}
signer_tag: ${{ needs.check-release.outputs.signer_tag }}
signer_docker_tag: ${{ needs.check-release.outputs.signer_docker_tag }}
is_node_release: ${{ needs.check-release.outputs.is_node_release }}
is_signer_release: ${{ needs.check-release.outputs.is_signer_release }}
secrets: inherit

## Build and push Debian image built from source
Expand Down
81 changes: 0 additions & 81 deletions .github/workflows/create-source-binary.yml

This file was deleted.

143 changes: 83 additions & 60 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,29 @@ name: Github Release
on:
workflow_call:
inputs:
tag:
description: "Release Tag"
node_tag:
description: "Node Release Tag"
required: true
type: string
docker_tag:
description: "Docker Release Tag"
node_docker_tag:
description: "Node Docker Release Tag"
required: true
type: string
cache_available:
description: "Is a cache available"
signer_tag:
description: "Signer Release Tag"
required: true
type: string
cache_pattern:
description: "The artifact pattern of the cache"
required: false
signer_docker_tag:
description: "Signer Docker Release Tag"
required: true
type: string
is_node_release:
description: "True if it is a node release"
required: true
type: string
is_signer_release:
description: "True if it is a signer release"
required: true
type: string
secrets:
GH_TOKEN:
Expand All @@ -30,83 +38,98 @@ concurrency:
## Always cancel duplicate jobs
cancel-in-progress: true

run-name: ${{ inputs.tag }}
run-name: ${{ inputs.node_tag || inputs.signer_tag }}

jobs:
## Build arch dependent binaries from source
##
## Runs when the following is true:
## - tag is provided
## - either node or signer tag is provided
build-binaries:
if: |
inputs.tag != ''
inputs.node_tag != '' ||
inputs.signer_tag != ''
name: Build Binaries
uses: ./.github/workflows/create-source-binary.yml
with:
tag: ${{ inputs.tag }}
cache_available: ${{ inputs.cache_available }}
cache_pattern: ${{ inputs.cache_pattern }}
secrets: inherit
runs-on: ubuntu-latest
strategy:
## Run a maximum of 10 builds concurrently, using the matrix defined in inputs.arch
max-parallel: 10
matrix:
arch:
- linux-musl
- linux-glibc
- macos
- windows
cpu:
- arm64
- armv7
- x86-64 ## defaults to x86-64-v3 variant - intel haswell (2013) and newer
# - x86-64-v2 ## intel nehalem (2008) and newer
# - x86-64-v3 ## intel haswell (2013) and newer
# - x86-64-v4 ## intel skylake (2017) and newer
exclude:
- arch: windows # excludes windows-arm64
cpu: arm64
- arch: windows # excludes windows-armv7
cpu: armv7
- arch: macos # excludes macos-armv7
cpu: armv7
steps:
- name: Build Binary (${{ matrix.arch }}_${{ matrix.cpu }})
uses: stacks-network/actions/stacks-core/release/create-source-binary@feat/release-signer-alongside-node
with:
arch: ${{ matrix.arch }}
cpu: ${{ matrix.cpu }}
node_tag: ${{ inputs.node_tag }}
signer_tag: ${{ inputs.signer_tag }}
is_node_release: ${{ inputs.is_node_release }}

## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
## - either node or signer tag is provided
create-release:
if: |
inputs.tag != ''
inputs.node_tag != '' ||
inputs.signer_tag != ''
name: Create Release
runs-on: ubuntu-latest
needs:
- build-binaries
steps:
## Downloads the artifacts built in `create-source-binary.yml`
- name: Download Artifacts
id: download_artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
pattern: ${{ inputs.tag }}-binary-build-*
path: release
merge-multiple: true

## Generate a checksums file to be added to the release page
- name: Generate Checksums
id: generate_checksum
uses: BowTiedDevOps/actions/generate-checksum@main
with:
artifact_download_pattern: "${{ inputs.tag }}-binary-build-*"

## Upload the release archives with the checksums file
- name: Upload Release
id: upload_release
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 #v2.0.5
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
## Creates releases
- name: Create Release
uses: stacks-network/actions/stacks-core/release/create-github-releases@feat/release-signer-alongside-node
with:
name: Release ${{ inputs.tag || github.ref }}
tag_name: ${{ inputs.tag || github.ref }}
draft: false
prerelease: true
fail_on_unmatched_files: true
target_commitish: ${{ github.sha }}
generate_release_notes: true
files: |
release/*.zip
CHECKSUMS.txt
node_tag: ${{ inputs.node_tag }}
signer_tag: ${{ inputs.signer_tag }}
is_node_release: ${{ inputs.is_node_release }}
is_signer_release: ${{ inputs.is_signer_release }}

## Builds arch dependent Docker images from binaries
##
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
## - either node or signer tag is provided
docker-image:
if: |
inputs.tag != ''
inputs.node_tag != '' ||
inputs.signer_tag != ''
strategy:
fail-fast: false
## Build a maximum of 2 images concurrently based on matrix.dist
max-parallel: 2
matrix:
dist:
- alpine
- debian
name: Docker Image (Binary)
uses: ./.github/workflows/image-build-binary.yml
uses: stacks-network/actions/stacks-core/release/create-docker-images@feat/release-signer-alongside-node
needs:
- build-binaries
- create-release
with:
tag: ${{ inputs.tag }}
docker_tag: ${{ inputs.docker_tag }}
secrets: inherit
node_tag: ${{ inputs.node_tag }}
node_docker_tag: ${{ inputs.node_docker_tag }}
signer_tag: ${{ inputs.signer_tag }}
signer_docker_tag: ${{ inputs.signer_docker_tag }}
is_node_release: ${{ inputs.is_node_release }}
is_signer_release: ${{ inputs.is_signer_release }}
secrets: inherit
Loading

0 comments on commit bac1b87

Please sign in to comment.