Skip to content

Commit

Permalink
Update GitHub release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
majd committed Dec 5, 2022
1 parent d42ba7e commit a2ce1c4
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 67 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/distribute.yml

This file was deleted.

18 changes: 9 additions & 9 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
- uses: actions/download-artifact@v2
with:
name: ipatool-darwin
path: ipatool
- run: chmod +x ./ipatool/ipatool-darwin
- run: ./ipatool/ipatool-darwin ${{ matrix.command }} --help
path: build
- run: chmod +x ./build/ipatool-darwin
- run: ./build/ipatool-darwin ${{ matrix.command }} --help
test_linux:
name: Test (Linux)
runs-on: ubuntu-latest
Expand All @@ -58,9 +58,9 @@ jobs:
- uses: actions/download-artifact@v2
with:
name: ipatool-linux
path: ipatool
- run: chmod +x ./ipatool/ipatool-linux
- run: ./ipatool/ipatool-linux ${{ matrix.command }} --help
path: build
- run: chmod +x ./build/ipatool-linux
- run: ./build/ipatool-linux ${{ matrix.command }} --help
test_windows:
name: Test (Windows)
runs-on: windows-latest
Expand All @@ -73,6 +73,6 @@ jobs:
- uses: actions/download-artifact@v2
with:
name: ipatool-windows
path: ipatool
- run: chmod +x ./ipatool/ipatool-windows
- run: ./ipatool/ipatool-windows ${{ matrix.command }} --help
path: build
- run: chmod +x ./build/ipatool-windows
- run: ./build/ipatool-windows ${{ matrix.command }} --help
2 changes: 1 addition & 1 deletion .github/workflows/issues-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Issues cleanup
name: Issues Cleanup

on:
issue_comment:
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
get_version:
name: Get version
runs-on: ubuntu-latest
steps:
- id: set_output
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
outputs:
version: ${{ steps.set_output.outputs.version }}
test:
name: Run tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go test -v github.com/majd/ipatool/...
build:
name: Build
runs-on: macos-latest
needs: [get_version, test]
strategy:
fail-fast: false
matrix:
os: [ darwin, linux, windows ]
arch: [ arm64, amd64 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
cache: true
- run: ./tools/version.sh
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- id: output
run: echo ::set-output name=file::ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.output.outputs.file }}
path: ${{ steps.output.outputs.file }}
if-no-files-found: error
release:
name: Release
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
os: [ darwin, linux, windows ]
arch: [ arm64, amd64 ]
steps:
- id: output
run: echo ::set-output name=file::ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- uses: actions/download-artifact@v2
with:
name: ${{ steps.output.outputs.file }}
path: bin
- run: tar -czvf ${{ steps.output.outputs.file }}.tar.gz bin/${{ steps.output.outputs.file }}
- run: ./tools/sha256sum.sh ${{ steps.output.outputs.file }}.tar.gz > ${{ steps.output.outputs.file }}.tar.gz.sha256sum
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.output.outputs.file }}.tar.gz
asset_name: ${{ steps.output.outputs.file }}.tar.gz
tag: ${{ github.ref }}
overwrite: false
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.output.outputs.file }}.tar.gz.sha256sum
asset_name: ${{ steps.output.outputs.file }}.tar.gz.sha256sum
tag: ${{ github.ref }}
overwrite: false
7 changes: 7 additions & 0 deletions tools/sha256sum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh -e

if which sha256sum >/dev/null 2>&1; then
sha256sum "$1" | awk '{ print $1 }'
else
shasum -a256 "$1" | awk '{ print $1 }'
fi

0 comments on commit a2ce1c4

Please sign in to comment.