8000 ci: Upload binaries to releases by acheroncrypto · Pull Request #3439 · solana-foundation/anchor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ci: Upload binaries to releases #3439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

pull_request:
branches:
- master
paths:
- VERSION

env:
DIST: dist-${{ github.ref_name }}

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- aarch64-apple-darwin
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
include:
- target: aarch64-apple-darwin
os: macos-latest

- target: x86_64-unknown-linux-gnu
os: ubuntu-latest

- target: x86_64-apple-darwin
os: macos-latest

- target: x86_64-pc-windows-msvc
os: windows-latest

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target }}

- name: Build release binary
run: cargo build --package anchor-cli --release --locked --target ${{ matrix.target }}

- name: Prepare
if: startsWith(github.ref, 'refs/tags/')
id: prepare
shell: bash
run: |
version=$(echo $GITHUB_REF_NAME | cut -dv -f2)
ext=""
[[ "${{ matrix.os }}" == windows-latest ]] && ext=".exe"

mkdir $DIST
mv "target/${{ matrix.target }}/release/anchor$ext" $DIST/anchor-$version-${{ matrix.target }}$ext

echo "version=$version" >> $GITHUB_OUTPUT

- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: anchor-${{ steps.prepare.outputs.version }}-${{ matrix.target }}
path: ${{ env.DIST }}
overwrite: true
retention-days: 1

upload:
name: Upload binaries to release
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: ${{ env.DIST }}

- name: Upload
shell: bash
run: GH_TOKEN=${{ secrets.GITHUB_TOKEN }} gh release upload $GITHUB_REF_NAME $DIST/*/* --clobber
Loading
0