generate latest version JSON #22
Workflow file for this run
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: Release Chsht | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
builds: | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
include: | |
- name: linux-amd64 | |
runner: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- name: win-amd64 | |
runner: windows-latest | |
target: x86_64-pc-windows-msvc | |
- name: macos-amd64 | |
runner: macos-latest | |
target: x86_64-apple-darwin | |
- name: macos-arm64 | |
runner: macos-latest | |
target: aarch64-apple-darwin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.22 | |
- name: Setup dependencies | |
if: matrix.runner == 'windows-latest' | |
run: | | |
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi /qn | |
- name: Setup dependencies | |
if: matrix.runner == 'macos-latest' | |
run: | | |
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" | |
sudo installer -pkg AWSCLIV2.pkg -target / | |
- name: Setup dependencies | |
if: matrix.runner == 'ubuntu-latest' | |
run: | | |
sudo apt-get update -q | |
sudo apt-get install -qqy build-essential software-properties-common pkg-config wget curl unzip libpcsclite-dev | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install --update | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: sa-east-1 | |
- name: Build darwin | |
if: matrix.runner == 'macos-latest' | |
run: | | |
export CGO_ENABLE=1 | |
go mod tidy | |
go build -o chsht-${{ matrix.name }} . | |
aws s3 cp ./chsht-${{ matrix.name }} s3://artifacts-mvrpl/chsht/releases/${{github.ref_name}}/chsht-${{ matrix.name }} | |
- name: Build linux | |
if: matrix.runner == 'ubuntu-latest' | |
run: | | |
export CGO_ENABLE=1 | |
go mod tidy | |
go build -o chsht-${{ matrix.name }} . | |
aws s3 cp ./chsht-${{ matrix.name }} s3://artifacts-mvrpl/chsht/releases/${{github.ref_name}}/chsht-${{ matrix.name }} | |
- name: Build windows | |
if: matrix.runner == 'windows-latest' | |
run: | | |
$env:CGO_ENABLE=1 | |
go mod tidy | |
go build -o chsht-${{ matrix.name }}.exe . | |
aws s3 cp ./chsht-${{ matrix.name }}.exe s3://artifacts-mvrpl/chsht/releases/${{github.ref_name}}/chsht-${{ matrix.name }}.exe | |
create_release: | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: [builds] | |
steps: | |
- name: Get SHA256 | |
id: get_sha256 | |
run: | | |
echo '{"version": "${{ github.ref_name }}"}' >> latest.json | |
aws s3 cp latest.json s3://artifacts-mvrpl/chsht/releases/latest.json | |
echo "SHA256_WIN_AMD64=$(curl -sL https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-win-amd64.exe | sha256sum | cut -d " " -f 1)" >> $GITHUB_ENV | |
echo "SHA256_MACOS_ARM64=$(curl -sL https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-macos-arm64 | sha256sum | cut -d " " -f 1)" >> $GITHUB_ENV | |
echo "SHA256_MACOS_AMD64=$(curl -sL https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-macos-amd64 | sha256sum | cut -d " " -f 1)" >> $GITHUB_ENV | |
echo "SHA256_LINUX_AMD64=$(curl -sL https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-linux-amd64 | sha256sum | cut -d " " -f 1)" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
## Binaries of version ${{ github.ref_name }} | |
| URL | System Architecture | SHA256 | | |
|-|-|-| | |
|https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-win-amd64.exe|x86_64-pc-windows-msvc|${{env.SHA256_WIN_AMD64}}| | |
|https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-macos-arm64|aarch64-apple-darwin|${{env.SHA256_MACOS_ARM64}}| | |
|https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-macos-amd64|x86_64-apple-darwin|${{env.SHA256_MACOS_AMD64}}| | |
|https://artifacts-mvrpl.s3.sa-east-1.amazonaws.com/chsht/releases/${{ github.ref_name }}/chsht-linux-amd64|x86_64-unknown-linux-gnu|${{env.SHA256_LINUX_AMD64}}| | |
draft: false | |
prerelease: false |