Skip to content

Commit

Permalink
Update workflow for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Rukenshia committed May 13, 2022
1 parent ae03c11 commit 1f1ead2
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: release


on:
workflow_dispatch:
inputs:
tag:
description: "Which tag to deploy as:"
description: 'Which tag to deploy as:'
required: true
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build-release:
Expand All @@ -22,14 +21,14 @@ jobs:
fail-fast: false
matrix:
targets:
- os: "ubuntu-20.04"
target: "x86_64-unknown-linux-gnu"
- os: 'ubuntu-20.04'
target: 'x86_64-unknown-linux-gnu'
cross: false
- os: "macos-11"
target: "x86_64-apple-darwin"
- os: 'macos-11'
target: 'x86_64-apple-darwin'
cross: false
- os: "windows-2019"
target: "x86_64-pc-windows-gnu"
- os: 'windows-2019'
target: 'x86_64-pc-windows-gnu'
cross: false

steps:
Expand All @@ -45,13 +44,13 @@ jobs:
toolchain: stable
override: true
target: ${{ matrix.targets.target }}

- name: Install linux packages
if: matrix.targets.os == 'ubuntu-20.04'
shell: bash
run: |
sudo apt-get install -y libdbus-1-dev
sudo apt-get update && sudo apt-get install -y libdbus-1-dev
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.targets.target }}
Expand All @@ -70,34 +69,33 @@ jobs:
cp target/${{ matrix.targets.target }}/release/saml2aws-auto.exe saml2aws-auto.exe
7z a saml2aws-auto-${{ matrix.targets.target }}.zip "saml2aws-auto.exe"
echo "ASSET=saml2aws-auto-${{ matrix.targets.target }}.zip" >> $GITHUB_ENV
- name: Bundle release (Linux and macOS)
if: matrix.targets.os != 'windows-2019'
shell: bash
run: |
cp target/${{ matrix.targets.target }}/release/saml2aws-auto ./saml2aws-auto
zip saml2aws-auto-${{ matrix.targets.target }}${{ matrix.targets.suffix }}.zip saml2aws-auto
echo "ASSET=saml2aws-auto-${{ matrix.targets.target }}${{ matrix.targets.suffix }}.zip" >> $GITHUB_ENV
- name: Create release directory for artifact, move file
shell: bash
run: |
mkdir release
mv ${{ env.ASSET }} release/
- name: Save release as artifact
uses: actions/upload-artifact@v2
with:
retention-days: 3
name: release
path: release

upload-release:
name: upload-release
runs-on: ubuntu-latest
needs: [build-release]
steps:

- name: Get the release version from the tag
if: env.VERSION == ''
run: |
Expand All @@ -107,11 +105,11 @@ jobs:
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
- name: Validate release version
run: |
echo "Release version: ${{ env.VERSION }}"
- name: Get release artifacts
uses: actions/download-artifact@v2
with:
Expand All @@ -122,7 +120,7 @@ jobs:
run: |
echo "Generated $(ls ./release | wc -l) files:"
ls ./release
- name: Upload all saved release files
uses: softprops/action-gh-release@v1
with:
Expand Down

0 comments on commit 1f1ead2

Please sign in to comment.