Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rosey release action #60

Merged
merged 1 commit into from
Aug 13, 2024
Merged
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
155 changes: 73 additions & 82 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,46 @@ jobs:
runs-on: ubuntu-20.04
needs: publish-github-release
steps:
- name: Clone
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.rustup
target
rosey/target
key: ${{ runner.os }}-stable
- name: Setup
run: |
rustup install stable
- name: Get Version
run: echo GIT_VERSION="$(git describe --tags | sed 's/^v\(.*\)$/\1/')" >> $GITHUB_ENV
- name: Prepare Git
run: |
git config user.email "[email protected]"
git config user.name "Github Actions"
git checkout -b main
# Use throw-away branch so we don't push the changes to origin
git checkout -b deploy_branch
- name: Prepare Crates
run: |
# Update cargo version,
node ./.backstage/version.cjs
git add ./rosey/Cargo.toml
# Commit changes so cargo doesn't complain about dirty repo
git commit -m "Deploy changes."
- name: Clone
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.rustup
target
rosey/target
key: ${{ runner.os }}-stable
- name: Setup
run: |
rustup install stable
- name: Get Version
run: echo GIT_VERSION="$(git describe --tags | sed 's/^v\(.*\)$/\1/')" >> $GITHUB_ENV
- name: Prepare Git
run: |
git config user.email "[email protected]"
git config user.name "Github Actions"
git checkout -b main
# Use throw-away branch so we don't push the changes to origin
git checkout -b deploy_branch
- name: Prepare Crates
run: |
# Update cargo version,
node ./.backstage/version.cjs
git add ./rosey/Cargo.toml
# Commit changes so cargo doesn't complain about dirty repo
git commit -m "Deploy changes."

- name: Build
working-directory: ./rosey
run: cargo build --release --verbose
- name: Publish
working-directory: ./rosey
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Build
working-directory: ./rosey
run: cargo build --release --verbose
- name: Publish
working-directory: ./rosey
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-npm-package:
name: Publish NPM package
Expand All @@ -68,10 +68,11 @@ jobs:
steps:
- name: Clone
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: release-checksums
path: wrappers/node/checksums
pattern: release-checksums-*
merge-multiple: true
- name: Prepare package
run: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
Expand Down Expand Up @@ -111,10 +112,11 @@ jobs:
- name: Get Tag
run: echo GIT_TAG="$(node ./.backstage/get_tag.cjs)" >> $GITHUB_ENV

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: release
path: build-artifacts
pattern: release-*
merge-multiple: true

- name: Build CHANGELOG
if: env.GIT_TAG == 'latest'
Expand Down Expand Up @@ -252,12 +254,12 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
default: true
components: rustfmt, clippy
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
default: true
components: rustfmt, clippy

- name: Install humane
uses: supplypike/setup-bin@v1
with:
Expand All @@ -274,7 +276,7 @@ jobs:
git checkout -b deploy_branch
- name: Prepare Crates
run: |
# Update cargo version,
# Update cargo version,
node ./.backstage/version.cjs
git add ./rosey/Cargo.toml
# Commit changes so cargo doesn't complain about dirty repo
Expand All @@ -290,60 +292,49 @@ jobs:

- name: Package Artifacts
run: |
src=$(pwd)
stage=
case $RUNNER_OS in
Windows)
stage=$(mktemp -d)
;;
Linux)
stage=$(mktemp -d)
;;
macOS)
stage=$(mktemp -d -t tmp)
;;
esac
cp rosey/target/${{ matrix.target }}/release/rosey $stage/
cd $stage
RELEASE_VERSION=${GITHUB_REF#refs/tags/}

EXEC_NAME="rosey"
ASSET_NAME="$EXEC_NAME-$RELEASE_VERSION-${{ matrix.target }}.tar.gz"
ASSET_PATH="$src/$ASSET_NAME"

ASSET_PATH="$EXEC_NAME-$RELEASE_VERSION-${{ matrix.target }}.tar.gz"
CHECKSUM_PATH="$ASSET_PATH.sha256"

tar czf $ASSET_PATH $EXEC_NAME
if [ "$RUNNER_OS" == "Windows" ]; then
EXEC_NAME="rosey.exe"
fi

tar czf $ASSET_PATH -C rosey/target/${{ matrix.target }}/release $EXEC_NAME

if command -v gtar &> /dev/null; then
echo "Using gtar"
gtar czf $ASSET_PATH -C rosey/target/${{ matrix.target }}/release $EXEC_NAME
else
echo "Using system tar"
tar czf $ASSET_PATH -C rosey/target/${{ matrix.target }}/release $EXEC_NAME
fi

cd $src
case $RUNNER_OS in
Windows)
sha256sum $ASSET_NAME > $CHECKSUM_PATH
sha256sum $ASSET_PATH > $CHECKSUM_PATH
;;
Linux)
sha256sum $ASSET_NAME > $CHECKSUM_PATH
sha256sum $ASSET_PATH > $CHECKSUM_PATH
;;
macOS)
shasum -a 256 $ASSET_NAME > $CHECKSUM_PATH
shasum -a 256 $ASSET_PATH > $CHECKSUM_PATH
;;
esac
if [ "$RUNNER_OS" == "Windows" ]; then
ASSET_PATH=$(echo "$ASSET_PATH" | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/')
CHECKSUM_PATH=$(echo "$CHECKSUM_PATH" | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/')
fi

echo "ASSET_PATH=$ASSET_PATH" >> $GITHUB_ENV
echo "CHECKSUM_PATH=$CHECKSUM_PATH" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: release
name: release-${{ matrix.target }}
path: |
${{ env.ASSET_PATH }}
${{ env.CHECKSUM_PATH }}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: release-checksums
name: release-checksums-${{ matrix.target }}
path: |
${{ env.CHECKSUM_PATH }}
Loading