mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-22 06:53:47 +08:00
feat: modify workflow to also build signer releases
This commit is contained in:
81
.github/workflows/ci.yml
vendored
81
.github/workflows/ci.yml
vendored
@@ -14,10 +14,6 @@ on:
|
||||
- "**.md"
|
||||
- "**.yml"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "The tag to create (optional)"
|
||||
required: false
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,7 +30,7 @@ concurrency:
|
||||
## Always cancel duplicate jobs
|
||||
cancel-in-progress: true
|
||||
|
||||
run-name: ${{ inputs.tag }}
|
||||
run-name: ${{ github.ref_name }}
|
||||
|
||||
jobs:
|
||||
##
|
||||
@@ -55,48 +51,76 @@ jobs:
|
||||
alias: "fmt-stacks"
|
||||
|
||||
######################################################################################
|
||||
## Create a tagged github release
|
||||
## Check if the head branch of the PR is a release branch
|
||||
##
|
||||
## Runs when the following is true:
|
||||
## - tag is provided
|
||||
## - The workflow was triggered by a `workflow_dispatch` action
|
||||
check-release:
|
||||
if: |
|
||||
(
|
||||
github.event_name == 'workflow_dispatch'
|
||||
)
|
||||
name: Check Release
|
||||
needs:
|
||||
- rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tag: ${{ steps.check_release.outputs.tag }}
|
||||
docker_tag: ${{ steps.check_release.outputs.docker_tag }}
|
||||
is_release: ${{ steps.check_release.outputs.is_release }}
|
||||
steps:
|
||||
- name: Check Release
|
||||
id: check_release
|
||||
uses: stacks-network/actions/stacks-core/check-release@main
|
||||
with:
|
||||
tag: ${{ github.ref_name }}
|
||||
|
||||
######################################################################################
|
||||
## Create a tagged github release
|
||||
##
|
||||
## Runs when:
|
||||
## - it is a release run
|
||||
create-release:
|
||||
if: |
|
||||
inputs.tag != ''
|
||||
needs.check-release.outputs.is_release == 'true'
|
||||
name: Create Release
|
||||
needs:
|
||||
- rustfmt
|
||||
- check-release
|
||||
uses: ./.github/workflows/github-release.yml
|
||||
with:
|
||||
tag: ${{ inputs.tag }}
|
||||
tag: ${{ needs.check-release.outputs.tag }}
|
||||
docker_tag: ${{ needs.check-release.outputs.docker_tag }}
|
||||
secrets: inherit
|
||||
|
||||
## Build and push Debian image built from source
|
||||
##
|
||||
## Runs when:
|
||||
## - tag is not provided
|
||||
## - it is not a release run
|
||||
docker-image:
|
||||
if: |
|
||||
inputs.tag == ''
|
||||
needs.check-release.outputs.is_release == 'false'
|
||||
name: Docker Image (Source)
|
||||
uses: ./.github/workflows/image-build-source.yml
|
||||
needs:
|
||||
- rustfmt
|
||||
- check-release
|
||||
secrets: inherit
|
||||
|
||||
## Create a reusable cache for tests
|
||||
##
|
||||
## Runs when:
|
||||
## - tag is provided
|
||||
## - it is a release run
|
||||
## or:
|
||||
## - no tag provided
|
||||
## - it is not a release run
|
||||
## and any of:
|
||||
## - this workflow is called manually
|
||||
## - PR is opened
|
||||
## - commit to either (development, master) branch
|
||||
create-cache:
|
||||
if: |
|
||||
inputs.tag != '' || (
|
||||
inputs.tag == '' && (
|
||||
needs.check-release.outputs.is_release == 'true' || (
|
||||
needs.check-release.outputs.is_release == 'false' && (
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'pull_request' ||
|
||||
github.event_name == 'merge_group' ||
|
||||
@@ -113,14 +137,15 @@ jobs:
|
||||
name: Create Test Cache
|
||||
needs:
|
||||
- rustfmt
|
||||
- check-release
|
||||
uses: ./.github/workflows/create-cache.yml
|
||||
|
||||
## Tests to run regularly
|
||||
##
|
||||
## Runs when:
|
||||
## - tag is provided
|
||||
## - it is a release run
|
||||
## or:
|
||||
## - no tag provided
|
||||
## - it is not a release run
|
||||
## and any of:
|
||||
## - this workflow is called manually
|
||||
## - PR is opened
|
||||
@@ -128,8 +153,8 @@ jobs:
|
||||
## - commit to either (development, next, master) branch
|
||||
stacks-core-tests:
|
||||
if: |
|
||||
inputs.tag != '' || (
|
||||
inputs.tag == '' && (
|
||||
needs.check-release.outputs.is_release == 'true' || (
|
||||
needs.check-release.outputs.is_release == 'false' && (
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'pull_request' ||
|
||||
github.event_name == 'merge_group' ||
|
||||
@@ -147,12 +172,13 @@ jobs:
|
||||
needs:
|
||||
- rustfmt
|
||||
- create-cache
|
||||
- check-release
|
||||
uses: ./.github/workflows/stacks-core-tests.yml
|
||||
|
||||
bitcoin-tests:
|
||||
if: |
|
||||
inputs.tag != '' || (
|
||||
inputs.tag == '' && (
|
||||
needs.check-release.outputs.is_release == 'true' || (
|
||||
needs.check-release.outputs.is_release == 'false' && (
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'pull_request' ||
|
||||
github.event_name == 'merge_group' ||
|
||||
@@ -170,33 +196,36 @@ jobs:
|
||||
needs:
|
||||
- rustfmt
|
||||
- create-cache
|
||||
- check-release
|
||||
uses: ./.github/workflows/bitcoin-tests.yml
|
||||
|
||||
## Test to run on a tagged release
|
||||
##
|
||||
## Runs when:
|
||||
## - tag is provided
|
||||
## - it is a release run
|
||||
atlas-tests:
|
||||
if: inputs.tag != ''
|
||||
if: needs.check-release.outputs.is_release == 'true'
|
||||
name: Atlas Tests
|
||||
needs:
|
||||
- rustfmt
|
||||
- create-cache
|
||||
- check-release
|
||||
uses: ./.github/workflows/atlas-tests.yml
|
||||
|
||||
epoch-tests:
|
||||
if: inputs.tag != ''
|
||||
if: needs.check-release.outputs.is_release == 'true'
|
||||
name: Epoch Tests
|
||||
needs:
|
||||
- rustfmt
|
||||
- create-cache
|
||||
- check-release
|
||||
uses: ./.github/workflows/epoch-tests.yml
|
||||
|
||||
slow-tests:
|
||||
if: inputs.tag != ''
|
||||
if: needs.check-release.outputs.is_release == 'true'
|
||||
name: Slow Tests
|
||||
needs:
|
||||
- rustfmt
|
||||
- create-cache
|
||||
- check-release
|
||||
uses: ./.github/workflows/slow-tests.yml
|
||||
|
||||
|
||||
9
.github/workflows/github-release.yml
vendored
9
.github/workflows/github-release.yml
vendored
@@ -9,6 +9,10 @@ on:
|
||||
description: "Release Tag"
|
||||
required: true
|
||||
type: string
|
||||
docker_tag:
|
||||
description: "Docker Release Tag"
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
GH_TOKEN:
|
||||
required: true
|
||||
@@ -68,8 +72,8 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
with:
|
||||
name: Release ${{ github.event.inputs.tag || github.ref }}
|
||||
tag_name: ${{ github.event.inputs.tag || github.ref }}
|
||||
name: Release ${{ inputs.tag || github.ref }}
|
||||
tag_name: ${{ inputs.tag || github.ref }}
|
||||
draft: false
|
||||
prerelease: true
|
||||
fail_on_unmatched_files: true
|
||||
@@ -94,4 +98,5 @@ jobs:
|
||||
- create-release
|
||||
with:
|
||||
tag: ${{ inputs.tag }}
|
||||
docker_tag: ${{ inputs.docker_tag }}
|
||||
secrets: inherit
|
||||
|
||||
71
.github/workflows/image-build-binary.yml
vendored
71
.github/workflows/image-build-binary.yml
vendored
@@ -6,6 +6,10 @@ on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
description: "Version tag of release"
|
||||
docker_tag:
|
||||
required: true
|
||||
type: string
|
||||
description: "Version tag for docker images"
|
||||
@@ -57,11 +61,39 @@ jobs:
|
||||
run: |
|
||||
echo "docker-org=${{ github.repository_owner }}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Check Signer Release
|
||||
id: check_signer_release
|
||||
run: |
|
||||
case "${{ inputs.tag }}" in
|
||||
signer-*)
|
||||
echo "is-signer-release=true" >> $GITHUB_ENV
|
||||
;;
|
||||
*)
|
||||
echo "is-signer-release=false" >> $GITHUB_ENV
|
||||
;;
|
||||
esac
|
||||
|
||||
## Set docker metatdata
|
||||
## - depending on the matrix.dist, different tags will be enabled
|
||||
## ex. debian will have this tag: `type=ref,event=tag,enable=${{ matrix.dist == 'debian' }}`
|
||||
- name: Docker Metadata ( ${{matrix.dist}} )
|
||||
id: docker_metadata
|
||||
if: ${{ env.is-signer-release == 'true' }}
|
||||
id: docker_metadata_signer
|
||||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 #v5.5.1
|
||||
with:
|
||||
images: |
|
||||
${{env.docker-org}}/stacks-signer
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ inputs.docker_tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'debian' }}
|
||||
type=raw,value=${{ inputs.docker_tag }}-${{ matrix.dist }},enable=${{ inputs.docker_tag != '' && matrix.dist == 'debian'}}
|
||||
type=raw,value=${{ inputs.docker_tag }},enable=${{ inputs.docker_tag != '' && matrix.dist == 'debian' }}
|
||||
type=ref,event=tag,enable=${{ matrix.dist == 'debian' }}
|
||||
type=raw,value=latest-${{ matrix.dist }},enable=${{ inputs.docker_tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'alpine' }}
|
||||
type=raw,value=${{ inputs.docker_tag }}-${{ matrix.dist }},enable=${{ inputs.docker_tag != '' && matrix.dist == 'alpine' }}
|
||||
|
||||
- name: Docker Metadata ( ${{matrix.dist}} )
|
||||
if: ${{ env.is-signer-release == 'false' }}
|
||||
id: docker_metadata_node
|
||||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 #v5.5.1
|
||||
with:
|
||||
## tag images with current repo name `stacks-core` as well as legacy `stacks-blockchain`
|
||||
@@ -69,22 +101,41 @@ jobs:
|
||||
${{env.docker-org}}/${{ github.event.repository.name }}
|
||||
${{env.docker-org}}/stacks-blockchain
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'debian' }}
|
||||
type=raw,value=${{ inputs.tag }}-${{ matrix.dist }},enable=${{ inputs.tag != '' && matrix.dist == 'debian'}}
|
||||
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' && matrix.dist == 'debian' }}
|
||||
type=raw,value=latest,enable=${{ inputs.docker_tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'debian' }}
|
||||
type=raw,value=${{ inputs.docker_tag }}-${{ matrix.dist }},enable=${{ inputs.docker_tag != '' && matrix.dist == 'debian'}}
|
||||
type=raw,value=${{ inputs.docker_tag }},enable=${{ inputs.docker_tag != '' && matrix.dist == 'debian' }}
|
||||
type=ref,event=tag,enable=${{ matrix.dist == 'debian' }}
|
||||
type=raw,value=latest-${{ matrix.dist }},enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'alpine' }}
|
||||
type=raw,value=${{ inputs.tag }}-${{ matrix.dist }},enable=${{ inputs.tag != '' && matrix.dist == 'alpine' }}
|
||||
type=raw,value=latest-${{ matrix.dist }},enable=${{ inputs.docker_tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'alpine' }}
|
||||
type=raw,value=${{ inputs.docker_tag }}-${{ matrix.dist }},enable=${{ inputs.docker_tag != '' && matrix.dist == 'alpine' }}
|
||||
|
||||
## Build docker image for release
|
||||
## Build docker image for signer release
|
||||
- name: Build and Push ( ${{matrix.dist}} )
|
||||
id: docker_build
|
||||
if: ${{ env.is-signer-release == 'true' }}
|
||||
id: docker_build_signer
|
||||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
||||
with:
|
||||
file: ./.github/actions/dockerfiles/Dockerfile.${{ matrix.dist }}-binary
|
||||
platforms: ${{ env.docker_platforms }}
|
||||
tags: ${{ steps.docker_metadata.outputs.tags }}
|
||||
labels: ${{ steps.docker_metadata.outputs.labels }}
|
||||
tags: ${{ steps.docker_metadata_signer.outputs.tags }}
|
||||
labels: ${{ steps.docker_metadata_signer.outputs.labels }}
|
||||
build-args: |
|
||||
TAG=${{ inputs.tag }}
|
||||
REPO=${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
|
||||
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
|
||||
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
|
||||
push: ${{ env.DOCKER_PUSH }}
|
||||
|
||||
## Build docker image for node release
|
||||
- name: Build and Push ( ${{matrix.dist}} )
|
||||
if: ${{ env.is-signer-release == 'false' }}
|
||||
id: docker_build_node
|
||||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
|
||||
with:
|
||||
file: ./.github/actions/dockerfiles/Dockerfile.${{ matrix.dist }}-binary
|
||||
platforms: ${{ env.docker_platforms }}
|
||||
tags: ${{ steps.docker_metadata_node.outputs.tags }}
|
||||
labels: ${{ steps.docker_metadata_node.outputs.labels }}
|
||||
build-args: |
|
||||
TAG=${{ inputs.tag }}
|
||||
REPO=${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||
|
||||
Reference in New Issue
Block a user