chore: release (#213) #55
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-24.04 | |
if: "contains(github.event.head_commit.message, 'chore: release')" | |
steps: | |
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev libudev-dev libgtk-4-dev libglib2.0-dev | |
- 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: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target ${{ matrix.target }} --exclude goldboot-linux | |
- 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-24.04 | |
needs: linux | |
steps: | |
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev libudev-dev libgtk-4-dev libglib2.0-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Build goldboot-linux image x86_64 | |
run: | | |
export RUST_BACKTRACE=1 | |
export RUST_LOG=debug | |
target/release/goldboot init --os Goldboot --executable target/release/goldboot-linux | |
target/release/goldboot cast --output goldboot-linux-x86_64.gb . | |
- 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 [ "${tag%-*}" = "goldboot-linux" ]; then | |
mv target/release/${tag%-*} "${tag%-*}_x86_64-unknown-linux-gnu" | |
gh release upload "${tag}" "${tag%-*}_x86_64-unknown-linux-gnu" | |
mv goldboot-linux-x86_64.gb "${tag%-*}_x86_64-unknown-linux-gnu.gb" | |
gh release upload "${tag}" "${tag%-*}_x86_64-unknown-linux-gnu.gb" | |
fi | |
done | |
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 --exclude goldboot-linux | |
- 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 --exclude goldboot-linux | |
- 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: | | |
foreach ($tag in $(git tag --points-at HEAD)) { | |
$tagWithoutSuffix = $tag -replace '-.*$' | |
if (Copy-Item -Path "target\release\$tagWithoutSuffix" -Destination "$tagWithoutSuffix_x86_64-pc-windows-msvc") { | |
gh release upload $tag "$tagWithoutSuffix_x86_64-pc-windows-msvc" | |
} | |
} | |
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: actions/download-artifact@v4 | |
with: | |
name: goldboot-registry-x86_64-unknown-linux-musl | |
path: goldboot/linux-amd64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: goldboot-registry-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 | |
archlinux: | |
name: archlinux / ${{ matrix.package }} | |
runs-on: ubuntu-latest | |
needs: github | |
strategy: | |
matrix: | |
package: | |
- goldboot | |
- goldboot-registry | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Find version tags | |
id: get_tags | |
run: | | |
for tag in $(git tag --points-at HEAD); do | |
if [ "${tag%-*}" = "${{ matrix.package }}" ]; then | |
echo "pkgver=${tag##*-}" >>"$GITHUB_OUTPUT" | |
fi | |
done | |
- uses: heyhusen/archlinux-package-action@v2 | |
with: | |
path: dist/pacman/${{ matrix.package }} | |
srcinfo: true | |
pkgver: ${{ steps.get_tags.outputs.pkgver }} | |
- name: Push release to AUR | |
env: | |
AUR_PRIVATE_KEY: ${{ secrets.AUR_PRIVATE_KEY }} | |
run: | | |
echo "${AUR_PRIVATE_KEY}" >/tmp/id_rsa | |
chmod 600 /tmp/id_rsa | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
ssh-keyscan -H aur.archlinux.org >/tmp/known_hosts | |
GIT_SSH_COMMAND='ssh -i /tmp/id_rsa -o UserKnownHostsFile=/tmp/known_hosts' git submodule update --init dist/pacman/${{ matrix.package }} | |
cd dist/pacman/${{ matrix.package }} | |
git add .SRCINFO PKGBUILD | |
git commit -m "release: ${{ steps.get_tags.outputs.pkgver }}" | |
GIT_SSH_COMMAND='ssh -i /tmp/id_rsa -o UserKnownHostsFile=/tmp/known_hosts' git push -u origin master |