chore: build windows artifacts on Github Actions (#25188)
* chore: always checkout repo from master * chore: rename variable tag => commit * chore: gh-release when tag is present * chore: add release-artifacts-auto * chore: skip build when channel is empty * chore: use GITHUB_REF_NAME as CI_BRANCH
This commit is contained in:
parent
e024806aa5
commit
e493e0033a
|
@ -0,0 +1,19 @@
|
||||||
|
name: release-artifacts-auto
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- v[0-9]+.[0-9]+
|
||||||
|
tags:
|
||||||
|
- v[0-9]+.[0-9]+.[0-9]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-artifacts:
|
||||||
|
uses: ./.github/workflows/release-artifacts.yml
|
||||||
|
with:
|
||||||
|
commit: ${{ github.sha }}
|
||||||
|
secrets:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
@ -3,16 +3,16 @@ name: release-artifacts-manually
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
commit:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
description: tag
|
description: commit
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-artifacts:
|
release-artifacts:
|
||||||
uses: ./.github/workflows/release-artifacts.yml
|
uses: ./.github/workflows/release-artifacts.yml
|
||||||
with:
|
with:
|
||||||
tag: ${{ github.event.inputs.tag }}
|
commit: ${{ github.event.inputs.commit }}
|
||||||
secrets:
|
secrets:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
|
@ -3,7 +3,7 @@ name: release-artifacts
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
commit:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
secrets:
|
secrets:
|
||||||
|
@ -17,10 +17,14 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
windows-build:
|
windows-build:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
|
outputs:
|
||||||
|
tag: ${{ steps.build.outputs.tag }}
|
||||||
|
channel: ${{ steps.build.outputs.channel }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
ref: master
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
|
@ -35,30 +39,41 @@ jobs:
|
||||||
cp -r ci/env.sh /tmp/env.sh
|
cp -r ci/env.sh /tmp/env.sh
|
||||||
|
|
||||||
- name: Switch Version
|
- name: Switch Version
|
||||||
if: ${{ inputs.tag }}
|
if: ${{ inputs.commit }}
|
||||||
run: |
|
run: |
|
||||||
git checkout ${{ inputs.tag }}
|
git checkout ${{ inputs.commit }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
id: build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
choco install openssl
|
choco install openssl
|
||||||
export OPENSSL_DIR="C:\Program Files\OpenSSL-Win64"
|
export OPENSSL_DIR="C:\Program Files\OpenSSL-Win64"
|
||||||
choco install protoc
|
choco install protoc
|
||||||
source /tmp/env.sh
|
source /tmp/env.sh
|
||||||
|
echo "::set-output name=tag::$CI_TAG"
|
||||||
|
eval "$(ci/channel-info.sh)"
|
||||||
|
echo "::set-output name=channel::$CHANNEL"
|
||||||
ci/publish-tarball.sh
|
ci/publish-tarball.sh
|
||||||
mkdir -p "github-action-s3-upload/${{ inputs.tag }}"
|
|
||||||
cp -v "solana-release-x86_64-pc-windows-msvc.tar.bz2" "github-action-s3-upload/${{ inputs.tag }}/"
|
- name: Prepare Upload Files
|
||||||
cp -v "solana-release-x86_64-pc-windows-msvc.yml" "github-action-s3-upload/${{ inputs.tag }}/"
|
if: ${{ steps.build.outputs.channel != '' || steps.build.outputs.tag != '' }}
|
||||||
cp -v "solana-install-init-x86_64-pc-windows-msvc"* "github-action-s3-upload/${{ inputs.tag }}/"
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p "github-action-s3-upload/${{ inputs.commit }}"
|
||||||
|
cp -v "solana-release-x86_64-pc-windows-msvc.tar.bz2" "github-action-s3-upload/${{ inputs.commit }}/"
|
||||||
|
cp -v "solana-release-x86_64-pc-windows-msvc.yml" "github-action-s3-upload/${{ inputs.commit }}/"
|
||||||
|
cp -v "solana-install-init-x86_64-pc-windows-msvc"* "github-action-s3-upload/${{ inputs.commit }}/"
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
|
if: ${{ steps.build.outputs.channel != '' || steps.build.outputs.tag != '' }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: windows-artifact
|
name: windows-artifact
|
||||||
path: github-action-s3-upload/
|
path: github-action-s3-upload/
|
||||||
|
|
||||||
windows-s3-upload:
|
windows-s3-upload:
|
||||||
|
if: ${{ needs.windows-build.outputs.channel != '' || needs.windows-build.outputs.tag != '' }}
|
||||||
needs: [windows-build]
|
needs: [windows-build]
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -80,6 +95,7 @@ jobs:
|
||||||
SOURCE_DIR: "github-action-s3-upload"
|
SOURCE_DIR: "github-action-s3-upload"
|
||||||
|
|
||||||
windows-gh-release:
|
windows-gh-release:
|
||||||
|
if: ${{ needs.windows-build.outputs.tag != '' }}
|
||||||
needs: [windows-build]
|
needs: [windows-build]
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -92,7 +108,7 @@ jobs:
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ inputs.tag }}
|
tag_name: ${{ inputs.commit }}
|
||||||
draft: true
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
github-action-s3-upload/${{ inputs.tag }}/*
|
github-action-s3-upload/${{ inputs.commit }}/*
|
||||||
|
|
|
@ -86,16 +86,11 @@ if [[ -n $CI ]]; then
|
||||||
export CI_BUILD_ID=$GITHUB_RUN_ID
|
export CI_BUILD_ID=$GITHUB_RUN_ID
|
||||||
export CI_JOB_ID=$GITHUB_RUN_NUMBER
|
export CI_JOB_ID=$GITHUB_RUN_NUMBER
|
||||||
export CI_REPO_SLUG=$GITHUB_REPOSITORY
|
export CI_REPO_SLUG=$GITHUB_REPOSITORY
|
||||||
|
export CI_BRANCH=$GITHUB_REF_NAME
|
||||||
|
|
||||||
CI_COMMIT=$(git rev-parse HEAD)
|
CI_COMMIT=$(git rev-parse HEAD)
|
||||||
export CI_COMMIT
|
export CI_COMMIT
|
||||||
|
|
||||||
CI_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
||||||
if [[ $CI_BRANCH == "HEAD" ]]; then
|
|
||||||
CI_BRANCH=""
|
|
||||||
fi
|
|
||||||
export CI_BRANCH
|
|
||||||
|
|
||||||
CI_TAG=$(git tag --points-at HEAD)
|
CI_TAG=$(git tag --points-at HEAD)
|
||||||
export CI_TAG
|
export CI_TAG
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue