Skip to content

Commit

Permalink
release action spacesprotocol#17
Browse files Browse the repository at this point in the history
  • Loading branch information
randomlogin committed Oct 22, 2024
1 parent 1461d98 commit ddf882b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 49 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Release
name: Release linux (x86_64)

# Trigger the workflow on push tags like "v*.*.*" (version tags)
on:
push:
tags:
Expand Down Expand Up @@ -40,19 +39,13 @@ jobs:
id: get_os
run: echo "::set-output name=os::$(uname -s | tr '[:upper:]' '[:lower:]')"

# Either we
- name: Create release archive
run: |
mkdir -p release
# ls -a
# echo "in target"
# ls target
ARCH="${{ steps.get_arch.outputs.arch }}"
OS="${{ steps.get_os.outputs.os }}"
cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH}
cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH}
# echo "in release"
# ls release
- name: Create GitHub Release
id: create_release
Expand All @@ -70,15 +63,3 @@ jobs:
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# # Upload release asset
# - name: Upload release asset
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./release.tar.gz
# asset_name: release-${{ env.TAG }}.tar.gz # Include the tag in the asset name
# asset_content_type: application/gzip
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

32 changes: 3 additions & 29 deletions .github/workflows/release-macos-arm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Release
name: Release macOs (arm)

# Trigger the workflow on push tags like "v*.*.*" (version tags)
on:
push:
tags:
Expand All @@ -25,29 +24,10 @@ jobs:
with:
toolchain: stable

# - name: Install macOS targets
# run: |
# rustup target add x86_64-apple-darwin
# rustup target add aarch64-apple-darwin
#
# # Build for x86_64
# - name: Build x86_64 binary
# run: |
# cargo build --release --target=x86_64-apple-darwin
# mv target/x86_64-apple-darwin/release/spaced ./release/spaced-${{ env.TAG }}-macos-x86_64
# mv target/x86_64-apple-darwin/release/space-cli ./release/space-cli-${{ env.TAG }}-macos-x86_64
#
# # Build for aarch64
# - name: Build aarch64 binary
# run: |
# cargo build --release --target=aarch64-apple-darwin
# mv target/aarch64-apple-darwin/release/spaced ./release/spaced-${{ env.TAG }}-macos-arm64
# mv target/aarch64-apple-darwin/release/space-cli ./release/space-cli-${{ env.TAG }}-macos-arm64

- name: Build release binary
run: cargo build --release

# Perhaps we can not run tests, as they are run by the CI workflow
# Perhaps we can ignore tests, as they are run by the CI workflow
# - name: Run tests
# run: cargo test --release

Expand All @@ -59,19 +39,13 @@ jobs:
id: get_os
run: echo "::set-output name=os::$(uname -s | tr '[:upper:]' '[:lower:]')"

# Either we
- name: Create release archive
run: |
mkdir -p release
ls -a
echo "in target"
ls target
ARCH="${{ steps.get_arch.outputs.arch }}"
OS="${{ steps.get_os.outputs.os }}"
cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH}
cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH}
echo "in release"
ls release
- name: Create GitHub Release
id: create_release
Expand All @@ -84,7 +58,7 @@ jobs:
draft: false
prerelease: false
files: |
release/spaced-${{ env.TAG }}-${{ steps.get_os.outputs.os }}-${ steps.get_arch.outputs.arch }}
release/spaced-${{ env.TAG }}-${{ steps.get_os.outputs.os }}-${{ steps.get_arch.outputs.arch }}
release/space-cli-${{ env.TAG }}-${{ steps.get_os.outputs.os }}-${{ steps.get_arch.outputs.arch }}
make_latest: true
env:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/release-macos-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release macOs (arm)

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: macos-13

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Dynamically create a tag from the pushed version
- name: Get the tag name
id: get_tag
run: |
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Build release binary
run: cargo build --release

# Perhaps we can not run tests, as they are run by the CI workflow
# - name: Run tests
# run: cargo test --release

- name: Get architecture
id: get_arch
run: echo "::set-output name=arch::$(uname -m)"

- name: Get OS
id: get_os
run: echo "::set-output name=os::$(uname -s | tr '[:upper:]' '[:lower:]')"

- name: Create release archive
run: |
mkdir -p release
ARCH="${{ steps.get_arch.outputs.arch }}"
OS="${{ steps.get_os.outputs.os }}"
cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH}
cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH}
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }} # Dynamically use the pushed tag
name: Release ${{ env.TAG }} # Use the tag for the release name
body: |
Automated release of version ${{ env.TAG }}.
draft: false
prerelease: false
files: |
release/spaced-${{ env.TAG }}-${{ steps.get_os.outputs.os }}-${{ steps.get_arch.outputs.arch }}
release/space-cli-${{ env.TAG }}-${{ steps.get_os.outputs.os }}-${{ steps.get_arch.outputs.arch }}
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit ddf882b

Please sign in to comment.