Skip to content

Commit

Permalink
Merge pull request #16 from jubako/fix_check_release
Browse files Browse the repository at this point in the history
Trigger the check_release on branch push, not on pull_request base branch.
  • Loading branch information
mgautierfr authored Feb 17, 2024
2 parents cee92a8 + 8e7ba46 commit 05ad8f2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/check_release.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
name: Check Release

on:
pull_request:
push:
branches:
- "r/[0-9]+.[0-9]+.[0-9]+(-[0-9a-zA-Z]+)?"
- 'r/[0-9]+.[0-9]+.[0-9]+'
- 'r/[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+'

jobs:
check-version:
name: check-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get the release version from the branch
if: env.VERSION == ''
run: |
VERSION=${{ github.head_ref }}
VERSION=${VERSION##r/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- uses: actions/checkout@v4
- name: Get the release version from the branch
if: env.VERSION == ''
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION##r/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
outputs:
version: ${{ env.VERSION }}

Expand Down Expand Up @@ -156,17 +157,21 @@ jobs:
name: Check cargo publication
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Test Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --dry-run -p libarx
# Until cargo publish can publish serveral package in the same time,
# only libarx will work in `--dry-run` mode.
# See https://github.com/rust-lang/cargo/issues/1169
#cargo publish --dry-run -p arx
#cargo publish --dry-run -p tar2arx
#cargo publish --dry-run -p zip2arx
- name: Install dependencies
run: |
sudo apt-get install -y libfuse-dev
- name: Checkout code
uses: actions/checkout@v4

- name: Test Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --dry-run -p libarx
# Until cargo publish can publish serveral package in the same time,
# only libarx will work in `--dry-run` mode.
# See https://github.com/rust-lang/cargo/issues/1169
#cargo publish --dry-run -p arx
#cargo publish --dry-run -p tar2arx
#cargo publish --dry-run -p zip2arx
3 changes: 2 additions & 1 deletion .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Pre-Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+(-[0-9a-zA-Z]+)?"
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+'

permissions:
contents: write
Expand Down

0 comments on commit 05ad8f2

Please sign in to comment.