Hopefull gh action works now? #3
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
name: Create Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Get version from Cargo.toml | |
id: get_version | |
run: | | |
VERSION=$(grep '^version =' Cargo.toml | sed 's/.*= "\(.*\)"/\1/') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.get_version.outputs.VERSION }} | |
release_name: Release v${{ steps.get_version.outputs.VERSION }} | |
draft: false | |
prerelease: false | |
- name: Build and package | |
run: | | |
cargo build --release | |
tar -czvf vpm-${{ steps.get_version.outputs.VERSION }}.tar.gz target/release/vpm | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./vpm-${{ steps.get_version.outputs.VERSION }}.tar.gz | |
asset_name: vpm-${{ steps.get_version.outputs.VERSION }}.tar.gz | |
asset_content_type: application/gzip | |
- name: Update install.sh | |
run: | | |
sed -i 's/VPM_VERSION=.*/VPM_VERSION="${{ steps.get_version.outputs.VERSION }}"/' install.sh | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add install.sh | |
git commit -m "Update install.sh with version ${{ steps.get_version.outputs.VERSION }}" | |
git push |