ci: enable release artifacts for windows, macos #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
github: | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, 'chore: release')" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: MarcoIeni/[email protected] | |
with: | |
command: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
linux: | |
name: linux / ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
needs: github | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- aarch64-unknown-linux-gnu | |
- aarch64-unknown-linux-musl | |
- i686-unknown-linux-gnu | |
- x86_64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
steps: | |
# TODO this needs to run in the cross container | |
# - name: Install dependencies | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y libudev-dev libgtk-4-dev libglib2.0-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
use_cross: true | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: goldboot-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/goldboot | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: goldboot-registry-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/goldboot-registry | |
- name: Upload artifacts to release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
run: | | |
for tag in $(git tag --points-at HEAD); do | |
if cp target/${{ matrix.target }}/release/${tag%-*} ${tag%-*}_${{ matrix.target }}; then | |
gh release upload "${tag}" "${tag%-*}_${{ matrix.target }}" | |
fi | |
done | |
goldboot-linux: | |
runs-on: ubuntu-latest | |
needs: linux | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: goldboot-x86_64-unknown-linux-musl | |
path: linux-amd64 | |
- name: Build goldboot-linux image x86_64 | |
run: | | |
export RUST_BACKTRACE=1 | |
export RUST_LOG=debug | |
chmod +x linux-amd64/goldboot | |
linux-amd64/goldboot init --mold Goldboot | |
linux-amd64/goldboot cast --output goldboot-linux-x86_64.gb . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: goldboot-linux-x86_64.gb | |
path: goldboot-linux-x86_64.gb | |
macos: | |
runs-on: macos-latest | |
needs: github | |
steps: | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: goldboot-x86_64-apple-darwin | |
path: target/release/goldboot | |
- name: Upload artifacts to release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
run: | | |
for tag in $(git tag --points-at HEAD); do | |
if cp target/release/${tag%-*} ${tag%-*}_x86_64-apple-darwin; then | |
gh release upload "${tag}" "${tag%-*}_x86_64-apple-darwin" | |
fi | |
done | |
windows: | |
runs-on: windows-latest | |
needs: github | |
steps: | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: goldboot-x86_64-pc-windows-msvc | |
path: target/release/goldboot | |
- name: Upload artifacts to release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
run: | | |
for tag in $(git tag --points-at HEAD); do | |
if cp target/release/${tag%-*} ${tag%-*}_x86_64-pc-windows-msvc; then | |
gh release upload "${tag}" "${tag%-*}_x86_64-pc-windows-msvc" | |
fi | |
done | |
docker: | |
runs-on: ubuntu-latest | |
needs: linux | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: goldboot-x86_64-unknown-linux-musl | |
path: goldboot/linux-amd64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: goldboot-aarch64-unknown-linux-musl | |
path: goldboot/linux-arm64 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Find version tags | |
id: get_tags | |
run: | | |
for tag in $(git tag --points-at HEAD); do | |
echo "${tag%-*}=${tag##*-}" >> "$GITHUB_OUTPUT" | |
done | |
- uses: docker/build-push-action@v5 | |
if: ${{ steps.get_tags.outputs.goldboot != '' }} | |
with: | |
context: goldboot | |
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 | |
push: true | |
tags: fossable/goldboot:latest,fossable/goldboot:${{ steps.get_tags.outputs.goldboot }} | |
- uses: docker/build-push-action@v5 | |
if: ${{ steps.get_tags.outputs.goldboot-registry != '' }} | |
with: | |
context: goldboot-registry | |
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 | |
push: true | |
tags: fossable/goldboot-registry:latest,fossable/goldboot-registry:${{ steps.get_tags.outputs.goldboot-registry }} | |
- uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: fossable/goldboot | |