-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set version properly in Github release
- Loading branch information
Showing
1 changed file
with
68 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,61 +7,61 @@ on: | |
- ci-release | ||
|
||
jobs: | ||
cargo-publish: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cargo publish | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: | | ||
cargo publish | ||
create-github-release: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
contents: write | ||
env: | ||
GITU_VERSION: "" | ||
outputs: | ||
upload_url: ${{ steps.release.outputs.upload_url }} | ||
gitu_version: ${{ env.GITU_VERSION }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: .recent-changelog-entry | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Gather information | ||
shell: bash | ||
if: env.GITU_VERSION == '' | ||
run: | | ||
echo "GITU_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV | ||
echo "version is: ${{ env.GITU_VERSION }}" | ||
echo "CHANGELOG_ENTRY<<EOF" >> $GITHUB_ENV | ||
cat .recent-changelog-entry >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
echo "changelog entry:" | ||
echo "${{ env.CHANGELOG_ENTRY }}" | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.GITU_VERSION }} | ||
release_name: ${{ env.GITU_VERSION }} | ||
body: "${{ env.CHANGELOG_ENTRY }}" | ||
# cargo-publish: | ||
# runs-on: ubuntu-latest | ||
# environment: release | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Cargo publish | ||
# env: | ||
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
# run: | | ||
# cargo publish | ||
|
||
# create-github-release: | ||
# runs-on: ubuntu-latest | ||
# environment: release | ||
# permissions: | ||
# contents: write | ||
# env: | ||
# GITU_VERSION: "" | ||
# outputs: | ||
# upload_url: ${{ steps.release.outputs.upload_url }} | ||
# gitu_version: ${{ env.GITU_VERSION }} | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# sparse-checkout: .recent-changelog-entry | ||
# sparse-checkout-cone-mode: false | ||
|
||
# - name: Gather information | ||
# shell: bash | ||
# if: env.GITU_VERSION == '' | ||
# run: | | ||
# echo "GITU_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV | ||
# echo "version is: ${{ env.GITU_VERSION }}" | ||
|
||
# echo "CHANGELOG_ENTRY<<EOF" >> $GITHUB_ENV | ||
# cat .recent-changelog-entry >> $GITHUB_ENV | ||
# echo "EOF" >> $GITHUB_ENV | ||
# echo "changelog entry:" | ||
# echo "${{ env.CHANGELOG_ENTRY }}" | ||
|
||
# - name: Create GitHub release | ||
# id: release | ||
# uses: actions/create-release@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: ${{ env.GITU_VERSION }} | ||
# release_name: ${{ env.GITU_VERSION }} | ||
# body: "${{ env.CHANGELOG_ENTRY }}" | ||
|
||
build-github-release: | ||
needs: ['create-github-release'] | ||
# needs: ['create-github-release'] | ||
runs-on: ${{ matrix.os }} | ||
environment: release | ||
permissions: | ||
|
@@ -94,6 +94,8 @@ jobs: | |
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
fetch-depth: 0 # Workaround to have a version set (gitu --version) | ||
fetch-tags: true | ||
|
||
- name: Build release binary | ||
run: cargo build --verbose --release --locked ${{ env.TARGET_FLAGS }} | ||
|
@@ -108,6 +110,8 @@ jobs: | |
cp {README.md,LICENSE} "$staging/" | ||
cp "target/${{ matrix.target }}/release/gitu" "$staging/" | ||
staging/gitu --version | ||
7z a -r "$staging.zip" "$staging" | ||
echo "ASSET=$staging.zip" >> $GITHUB_ENV | ||
|
@@ -121,15 +125,17 @@ jobs: | |
cp {README.md,LICENSE} "$staging/" | ||
cp "target/${{ matrix.target }}/release/gitu" "$staging/" | ||
staging/gitu --version | ||
tar czvf "$staging.tar.gz" "$staging" | ||
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-github-release.outputs.upload_url }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream | ||
# - name: Upload release archive | ||
# uses: actions/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# upload_url: ${{ needs.create-github-release.outputs.upload_url }} | ||
# asset_path: ${{ env.ASSET }} | ||
# asset_name: ${{ env.ASSET }} | ||
# asset_content_type: application/octet-stream |