solana/.github/workflows/release-artifacts.yml

120 lines
3.7 KiB
YAML

name: release-artifacts
on:
workflow_call:
inputs:
commit:
required: false
type: string
secrets:
GCS_RELEASE_BUCKET_WRITER_CREDIENTIAL:
required: true
jobs:
windows-build:
runs-on: windows-2022
outputs:
tag: ${{ steps.build.outputs.tag }}
channel: ${{ steps.build.outputs.channel }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- name: Setup Rust
shell: bash
run: |
source ci/rust-version.sh stable
# copy the newest version env.sh before switching version.
- name: Copy Env Script
shell: bash
run: |
cp -r ci/env.sh /tmp/env.sh
- name: Switch Version
if: ${{ inputs.commit }}
run: |
git checkout ${{ inputs.commit }}
- name: Build
id: build
shell: bash
run: |
choco install openssl --version=3.1.1
if [[ -d "C:\Program Files\OpenSSL" ]]; then
echo "OPENSSL_DIR: C:\Program Files\OpenSSL"
export OPENSSL_DIR="C:\Program Files\OpenSSL"
elif [[ -d "C:\Program Files\OpenSSL-Win64" ]]; then
echo "OPENSSL_DIR: C:\Program Files\OpenSSL-Win64"
export OPENSSL_DIR="C:\Program Files\OpenSSL-Win64"
else
echo "can't determine OPENSSL_DIR"
exit 1
fi
choco install protoc
export PROTOC="C:\ProgramData\chocolatey\lib\protoc\tools\bin\protoc.exe"
source /tmp/env.sh
echo "tag=$CI_TAG" >> $GITHUB_OUTPUT
eval "$(ci/channel-info.sh)"
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
ci/publish-tarball.sh
- name: Prepare Upload Files
if: ${{ steps.build.outputs.channel != '' || steps.build.outputs.tag != '' }}
shell: bash
run: |
FOLDER_NAME=${{ steps.build.outputs.tag || steps.build.outputs.channel }}
mkdir -p "windows-release/$FOLDER_NAME"
cp -v "solana-release-x86_64-pc-windows-msvc.tar.bz2" "windows-release/$FOLDER_NAME/"
cp -v "solana-release-x86_64-pc-windows-msvc.yml" "windows-release/$FOLDER_NAME/"
cp -v "solana-install-init-x86_64-pc-windows-msvc"* "windows-release/$FOLDER_NAME"
- name: Upload Artifacts
if: ${{ steps.build.outputs.channel != '' || steps.build.outputs.tag != '' }}
uses: actions/upload-artifact@v3
with:
name: windows-artifact
path: windows-release/
windows-gcs-upload:
if: ${{ needs.windows-build.outputs.channel != '' || needs.windows-build.outputs.tag != '' }}
needs: [windows-build]
runs-on: ubuntu-20.04
steps:
- name: Download
uses: actions/download-artifact@v3
with:
name: windows-artifact
path: ./windows-release
- name: Setup crediential
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCS_RELEASE_BUCKET_WRITER_CREDIENTIAL }}"
- name: Upload files to GCS
run: |
gcloud storage cp --recursive windows-release/* gs://anza-release/
windows-gh-release:
if: ${{ needs.windows-build.outputs.tag != '' }}
needs: [windows-build]
runs-on: ubuntu-20.04
steps:
- name: Download
uses: actions/download-artifact@v3
with:
name: windows-artifact
path: .windows-release/
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.windows-build.outputs.tag }}
draft: true
files: |
windows-release/${{ needs.windows-build.outputs.tag }}/*