Skip to content
Closed
Show file tree
Hide file tree
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
59 changes: 39 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ jobs:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-msvc, os: windows-2019 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, features: default }
- { target: wasm32-wasi, os: ubuntu-20.04, features: "" }
- { target: x86_64-apple-darwin, os: macos-latest, features: default }
- { target: x86_64-pc-windows-msvc, os: windows-2019, features: default }

steps:
- uses: actions/checkout@v3
Expand All @@ -38,31 +39,33 @@ jobs:
echo "PROJECT_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
echo "Version: ${{ env.PROJECT_VERSION }}"

- name: Check git tag against toml values
if: ${{ matrix.job.os != 'windows-2019' }} # windows too weird
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are identical among jobs, so just checking on one job, ubuntu-20.04 for example, is enough.

Copy link
Contributor Author

@jcaesar jcaesar May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what I thought at first, too, but tell me: Won't the publish step for the other os still run, creating a release with some missing files?

- name: Publish
if: ${{ contains(github.ref, '/tags/') }}
uses: softprops/action-gh-release@v1
with:
files: ${{ env.PKG_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

run: |
grep -q "version = \"$PROJECT_VERSION\"" Cargo.toml
grep -q "version = \"$PROJECT_VERSION\"" wapm.toml

- name: Build release
run: cargo build --locked --verbose --release --target=${{ matrix.job.target }}
run: cargo build --locked --verbose --release --target=${{ matrix.job.target }} --no-default-features --features '${{ matrix.job.features }}'
env:
RUSTFLAGS: -C strip=symbols

- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: bin-${{ matrix.job.target }}
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ env.EXE_SUFFIX }}

- name: Set up path
- name: Create tarball
shell: bash
run: |
EXE_SUFFIX=""
[ "${{ matrix.job.target }}" = "x86_64-pc-windows-msvc" ] && EXE_SUFFIX=".exe"
[ "${{ matrix.job.target }}" = "wasm32-wasi" ] && EXE_SUFFIX=".wasm"
echo "EXE_SUFFIX=${EXE_SUFFIX}" >> "$GITHUB_ENV"

BIN_PATH="target/${{ matrix.job.target }}/release/omekasy${EXE_SUFFIX}"
echo "BIN_PATH=${BIN_PATH}" >> "${GITHUB_ENV}"

- name: Strip binary
shell: bash
run: |
STRIP="strip"
[ "${{ matrix.job.target }}" = "x86_64-pc-windows-msvc" ] && STRIP=""

if [ -n "${STRIP}" ]; then
"${STRIP}" "${{ env.BIN_PATH }}"
fi

- name: Create tarball
shell: bash
run: |
PKG_SUFFIX=".tar.gz" ; case "${{ matrix.job.target }}" in *-pc-windows-*) PKG_SUFFIX=".zip" ;; esac;
PKG_BASENAME="${PROJECT_NAME}-v${{ env.PROJECT_VERSION }}-${{ matrix.job.target }}"
PKG_PATH="${PKG_BASENAME}${PKG_SUFFIX}"
Expand All @@ -71,7 +74,7 @@ jobs:
PKG_DIR="archive"
mkdir -p "${PKG_DIR}"
cp {README.md,LICENSE} "$PKG_DIR"
cp "${{ env.BIN_PATH }}" "${PKG_DIR}"
cp "${BIN_PATH}" "${PKG_DIR}"

if [ "${{ matrix.job.os }}" = "windows-2019" ]; then
7z a "${PKG_PATH}" "${PKG_DIR}"
Expand Down Expand Up @@ -102,3 +105,19 @@ jobs:
git config --global user.email "runner@gha.local"
git config --global user.name "Github Action"
cargo publish --allow-dirty --token ${{ secrets.CRATES_IO_TOKEN }}

wapm-publish:
runs-on: ubuntu-20.04
needs: release
steps:
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v1
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: bin-wasm32-wasi
path: target/wasm32-wasi/release
- name: WAPM publish
run: wapm publish
env:
WAPM_REGISTRY_TOKEN: ${{ secrets.WAPM_REGISTRY_TOKEN }}
19 changes: 19 additions & 0 deletions wapm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "ikanago/omekasy"
version = "1.1.0"
description = "𝘾𝙤𝙢𝙢𝙖𝙣𝙙 𝙡𝙞𝙣𝙚 𝙖𝙥𝙥𝙡𝙞𝙘𝙖𝙩𝙞𝙤𝙣 𝕥𝕙𝕒𝕥 𝕔𝕠𝕟𝕧𝕖𝕣𝕥𝕤 𝕒𝕝𝕡𝕙𝕒𝕟𝕦𝕞𝕖𝕣𝕚𝕔 𝕔𝕙𝕒𝕣𝕒𝕔𝕥𝕖𝕣𝕤 𝒕𝒐 𝒗𝒂𝒓𝒊𝒐𝒖𝒔 𝒔𝒕𝒚𝒍𝒆𝒔 𝚍𝚎𝚏𝚒𝚗𝚎𝚍 𝚒𝚗 𝚄𝚗𝚒𝚌𝚘𝚍𝚎."
license = "MIT"
repository = "https://github.com/ikanago/omekasy"
readme = "README.md"

[[module]]
name = "omekasy"
source = "target/wasm32-wasi/release/omekasy.wasm"
abi = "wasi"

[module.interfaces]
wasi = "0.1.0-unstable"

[[command]]
name = "omekasy"
module = "omekasy"