Skip to content

Updated README

Updated README #18

Workflow file for this run

# Workflow triggered on creation of a new tag:
# - creates a release
# - builds packages and uploads them to the release
#
# Reference:
# https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/
name: release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
# Outputs are required for upload of release artifacts
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
release_version: ${{ env.RELEASE_VERSION }}
steps:
- name: Get the release version from the tag
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "release version is: ${{ env.RELEASE_VERSION }}"
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
build-release:
name: Build release
needs: ['create-release']
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
include:
- build: x86_64-pc-windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
- build: x86_64-unknown-linux-gnu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: x86_64-apple-darwin
os: macos-latest
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Build
run: cargo build --verbose --target=${{ matrix.target }} --release
- name: Package
shell: bash
run: |
package="psa-update-${{ needs.create-release.outputs.release_version }}-${{ matrix.build }}"
mkdir "$package"
cp "README.md" "LICENCE.md" "$package"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.target }}/release/psa-update.exe" "$package"
7z a "$package.zip" "$package"
certutil -hashfile "$package.zip" SHA256 > "$package.zip.sha256"
echo "ASSET_PATH=$package.zip" >> $GITHUB_ENV
echo "ASSET_CSUM_PATH=$package.zip.sha256" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/psa-update" "$package"
tar czf "$package.tar.gz" "$package"
shasum -a 256 "$package.tar.gz" > "$package.tar.gz.sha256"
echo "ASSET_PATH=$package.tar.gz" >> $GITHUB_ENV
echo "ASSET_CSUM_PATH=$package.tar.gz.sha256" >> $GITHUB_ENV
fi
- name: Upload release archive
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ env.ASSET_PATH }}
${{ env.ASSET_CSUM_PATH }}