chore: build x86 artifacts (#24941)

* chore: add GitHub Action env

* chore: add github tarball output path

* chore: add build x86 actions
This commit is contained in:
Yihau Chen 2022-05-03 23:20:23 +08:00 committed by GitHub
parent fd44198c0a
commit 9f163a87c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 197 additions and 0 deletions

View File

@ -0,0 +1,15 @@
name: release-artifacts-manually
on:
workflow_dispatch:
inputs:
tag:
type: string
required: true
description: tag
jobs:
release-artifacts:
uses: ./.github/workflows/release-artifacts.yml
with:
tag: ${{ github.event.inputs.tag }}

138
.github/workflows/release-artifacts.yml vendored Normal file
View File

@ -0,0 +1,138 @@
name: release-artifacts
on:
workflow_call:
inputs:
tag:
required: false
type: string
jobs:
osx-build:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 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.tag }}
run: |
git checkout ${{ inputs.tag }}
- name: Build
shell: bash
run: |
brew install coreutils
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
brew install gnu-tar
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
source /tmp/env.sh
ci/publish-tarball.sh
mkdir -p "github-action-s3-upload/${{ inputs.tag }}"
cp -v "solana-release-x86_64-apple-darwin.tar.bz2" "github-action-s3-upload/${{ inputs.tag }}/"
cp -v "solana-release-x86_64-apple-darwin.yml" "github-action-s3-upload/${{ inputs.tag }}/"
cp -v "solana-install-init-x86_64-apple-darwin"* "github-action-s3-upload/${{ inputs.tag }}/"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: osx-artifact
path: github-action-s3-upload/
osx-s3-upload:
needs: [osx-build]
runs-on: ubuntu-20.04
steps:
- name: Download
uses: actions/download-artifact@v3
with:
name: osx-artifact
path: ./github-action-s3-upload
- name: Upload
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: "us-west-1"
SOURCE_DIR: "github-action-s3-upload"
windows-build:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 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.tag }}
run: |
git checkout ${{ inputs.tag }}
- name: Build
shell: bash
run: |
choco install openssl
export OPENSSL_DIR="C:\Program Files\OpenSSL-Win64"
choco install protoc
source /tmp/env.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 }}/"
cp -v "solana-release-x86_64-pc-windows-msvc.yml" "github-action-s3-upload/${{ inputs.tag }}/"
cp -v "solana-install-init-x86_64-pc-windows-msvc"* "github-action-s3-upload/${{ inputs.tag }}/"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: windows-artifact
path: github-action-s3-upload/
windows-s3-upload:
needs: [windows-build]
runs-on: ubuntu-20.04
steps:
- name: Download
uses: actions/download-artifact@v3
with:
name: windows-artifact
path: ./github-action-s3-upload
- name: Upload
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: "us-west-1"
SOURCE_DIR: "github-action-s3-upload"

View File

@ -81,6 +81,42 @@ if [[ -n $CI ]]; then
fi
export CI_REPO_SLUG=$APPVEYOR_REPO_NAME
export CI_TAG=$APPVEYOR_REPO_TAG_NAME
elif [[ $GITHUB_ACTION ]]; then
export CI_BUILD_ID=$GITHUB_RUN_ID
export CI_JOB_ID=$GITHUB_RUN_NUMBER
export CI_REPO_SLUG=$GITHUB_REPOSITORY
CI_COMMIT=$(git rev-parse HEAD)
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)
export CI_TAG
if [[ $GITHUB_BASE_REF ]]; then
export CI_BASE_BRANCH=$GITHUB_BASE_REF
export CI_PULL_REQUEST=true
fi
case $RUNNER_OS in
macOS)
export CI_OS_NAME=osx
;;
Windows)
export CI_OS_NAME=windows
;;
Linux)
export CI_OS_NAME=linux
;;
*)
;;
esac
fi
else
export CI=

View File

@ -136,6 +136,14 @@ for file in "${TARBALL_BASENAME}"-$TARGET.tar.bz2 "${TARBALL_BASENAME}"-$TARGET.
mkdir -p travis-release-upload/
cp -v "$file" travis-release-upload/
fi
elif [[ -n $GITHUB_ACTIONS ]]; then
mkdir -p github-action-s3-upload/"$CHANNEL_OR_TAG"
cp -v "$file" github-action-s3-upload/"$CHANNEL_OR_TAG"/
if [[ -n $TAG ]]; then
mkdir -p github-action-release-upload/
cp -v "$file" github-action-release-upload/
fi
elif [[ -n $APPVEYOR ]]; then
# Add artifacts for .appveyor.yml to upload
appveyor PushArtifact "$file" -FileName "$CHANNEL_OR_TAG"/"$file"