Merge: local changes (#16) #2
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: | ||
- "master" | ||
- "release/**" | ||
jobs: | ||
create-release: | ||
name: create release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
outputs: | ||
version_output: ${{ steps.version.outputs.project_version }} | ||
upload_url_output: ${{ steps.release.outputs.upload_url }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get project version | ||
id: version | ||
run: | | ||
VERSION=$(cargo metadata --format-version=1 | jq '.packages[] | select(.name=="news-rss").version') | ||
echo "project_version=$VERSION" | grep -E '\d\.\d\.\d' >> $GITHUB_OUTPUT | ||
- name: Create github release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
draft: false | ||
prerelease: false | ||
body_path: CHANGELOG.md | ||
tag_name: news-rss-${{ steps.version.outputs.project_version }} | ||
release_name: news-rss-${{ steps.version.outputs.project_version }} | ||
build: | ||
name: build project | ||
runs-on: ${{ matrix.platform.runs-on }} | ||
needs: create-release | ||
permissions: | ||
contents: write-all | ||
strategy: | ||
matrix: | ||
platform: | ||
- os-name: Linux-x86_64 | ||
runs-on: ubuntu-20.04 | ||
target: x86_64-unknown-linux-gnu | ||
- os-name: Windows-x86_64 | ||
runs-on: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
- os-name: macOS-x86_64 | ||
runs-on: macOS-latest | ||
target: x86_64-apple-darwin | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
- name: Add rustup target ${{ matrix.platform.target }} | ||
run: rustup target add ${{ matrix.platform.target }} | ||
- name: Build rust library | ||
run: cargo build --release | ||
- name: Build app for ${{matrix.platform.target }} | ||
run: cargo build --release --target ${{ matrix.platform.target }} | ||
- name: Create archive | ||
uses: vimtor/action-zip@5f1c4aa587ea41db1110df6a99981dbe19cee310 | ||
with: | ||
files: ./target | ||
dest: news-rss-${{ needs.create-release.outputs.version_output }}.zip | ||
recursive: true | ||
- name: Upload linux artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url_output }} | ||
asset_name: news-rss-${{ needs.create-release.outputs.version_output }}.zip | ||
asset_path: ./news-rss-${{ needs.create-release.outputs.version_output }}.zip | ||
asset_content_type: application/zip |