Compare commits

..

No commits in common. "main" and "v0.1.0" have entirely different histories.
main ... v0.1.0

3 changed files with 21 additions and 124 deletions

View File

@ -22,9 +22,10 @@ jobs:
- uses: actions-rust-lang/audit@v1 - uses: actions-rust-lang/audit@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
publish-crate: crates_io_publish:
name: Publish to crates.io name: Publish (crates.io)
needs: [audit] needs:
- audit
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 25 timeout-minutes: 25
steps: steps:
@ -40,7 +41,22 @@ jobs:
if: steps.cargo_release_cache.outputs.cache-hit != 'true' if: steps.cargo_release_cache.outputs.cache-hit != 'true'
- name: cargo login - name: cargo login
run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }} run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
# Publishing is currently messy, because:
#
# * `peace_rt_model_core` exports `NativeError` or `WebError` depending on the target.
# * `peace_rt_model_web` fails to build when publishing the workspace for a native target.
# * `peace_rt_model_web` still needs its dependencies to be published before it can be
# published.
# * `peace_rt_model_hack` needs `peace_rt_model_web` to be published before it can be
# published.
#
# We *could* pass through `--no-verify` so `cargo` doesn't build the crate before publishing,
# which is reasonable, since this job only runs after the Linux, Windows, and WASM builds
# have passed.
- name: "cargo release publish" - name: "cargo release publish"
# allow-branch HEAD is because GitHub actions switches
# to the tag while building, which is a detached head
run: |- run: |-
cargo release \ cargo release \
publish \ publish \
@ -50,122 +66,3 @@ jobs:
--no-confirm \ --no-confirm \
--no-verify \ --no-verify \
--execute --execute
github-release:
name: Create GitHub Release
needs: [audit]
permissions:
contents: write
strategy:
matrix:
include:
- 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
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare assets
shell: bash
run: |
cd target/${{ matrix.target }}/release
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a ../../sula-alus-${{ matrix.target }}.zip sula-alus.exe
else
tar czf ../../sula-alus-${{ matrix.target }}.tar.gz sula-alus
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: sula-alus-${{ matrix.target }}
path: target/sula-alus-${{ matrix.target }}.*
compression-level: 0
create-release:
needs: [github-release]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/sula-alus-*
generate_release_notes: true
publish-aur:
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version and description
id: metadata
run: |
DESCRIPTION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].description')
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "DESCRIPTION=${DESCRIPTION}" >> $GITHUB_OUTPUT
- name: Get SHA256 sum
id: sha256
run: |
curl -LO "${{ github.server_url }}/${{ github.repository }}/releases/download/v${{ steps.get_version.outputs.VERSION }}/sula-alus-x86_64-unknown-linux-gnu.tar.gz"
echo "SHA256=$(sha256sum sula-alus-x86_64-unknown-linux-gnu.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
- name: Generate PKGBUILD
run: |
cat > PKGBUILD << 'EOF'
# Maintainer: Kristofers Solo <dev@kristofers.xyz>
pkgname=sula-alus-bin
pkgver=${{ steps.metadata.outputs.VERSION }}
pkgrel=1
pkgdesc="${{ steps.metadata.outputs.DESCRIPTION }}"
arch=("x86_64")
url="https://github.com/kristoferssolo/sula-alus"
license=("MIT" "Apache-2.0")
provides=("sula-alus")
conflicts=("sula-alus" "sula-alus-git")
source=("\${url}/releases/download/v\${pkgver}/sula-alus-x86_64-unknown-linux-gnu.tar.gz")
EOF
- name: Update SHA256 and package function
run: |
echo "sha256sums=(\"${{ steps.sha256.outputs.SHA256 }}\")" >> PKGBUILD
echo >> PKGBUILD
cat >> PKGBUILD << 'EOF'
prepare() {
cd "$srcdir"
tar xf "sula-alus-x86_64-unknown-linux-gnu.tar.gz"
}
package() {
cd "$srcdir"
install -Dm755 sula-alus "${pkgdir}/usr/bin/sula-alus"
}
EOF
- name: Generate .SRCINFO
run: |
docker run --rm -v "$PWD":/pkg -w /pkg archlinux:base-devel bash -c '
useradd -m builder && \
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown -R builder:builder /pkg && \
su builder -c "makepkg --printsrcinfo > .SRCINFO"
'
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v3.0.1
with:
pkgname: sula-alus-bin
pkgbuild: ./PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "Update to version ${{ steps.metadata.outputs.VERSION }}"
ssh_keyscan_types: rsa,ecdsa,ed25519

2
Cargo.lock generated
View File

@ -142,7 +142,7 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]] [[package]]
name = "sula-alus" name = "sula-alus"
version = "0.1.5" version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
] ]

View File

@ -1,7 +1,7 @@
[package] [package]
name = "sula-alus" name = "sula-alus"
authors = ["Kristofers Solo <dev@kristofers.xyz>"] authors = ["Kristofers Solo <dev@kristofers.xyz>"]
version = "0.1.5" version = "0.1.0"
edition = "2021" edition = "2021"
description = "A CLI tool to encode strings and files using Sula-Alus encoding" description = "A CLI tool to encode strings and files using Sula-Alus encoding"
repository = "https://github.com/kristoferssolo/sula-alus" repository = "https://github.com/kristoferssolo/sula-alus"