Skip to content

Close temporary file (#249) #22

Close temporary file (#249)

Close temporary file (#249) #22

Workflow file for this run

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: go generate github.com/majd/ipatool/...
- run: go test -v github.com/majd/ipatool/...
build:
name: Build
runs-on: macos-latest
needs: [get_version, test]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
cache: true
- run: go build -ldflags="-X github.com/majd/ipatool/v2/cmd.version=$VERSION" -o ipatool-$VERSION-windows-arm64.exe
env:
GOOS: windows
GOARCH: arm64
VERSION: ${{ needs.get_version.outputs.version }}
- run: go build -ldflags="-X github.com/majd/ipatool/v2/cmd.version=$VERSION" -o ipatool-$VERSION-windows-amd64.exe
env:
GOOS: windows
GOARCH: amd64
VERSION: ${{ needs.get_version.outputs.version }}
- run: go build -ldflags="-X github.com/majd/ipatool/v2/cmd.version=$VERSION" -o ipatool-$VERSION-linux-arm64
env:
GOOS: linux
GOARCH: arm64
VERSION: ${{ needs.get_version.outputs.version }}
- run: go build -ldflags="-X github.com/majd/ipatool/v2/cmd.version=$VERSION" -o ipatool-$VERSION-linux-amd64
env:
GOOS: linux
GOARCH: amd64
VERSION: ${{ needs.get_version.outputs.version }}
- run: go build -ldflags="-X github.com/majd/ipatool/v2/cmd.version=$VERSION" -o ipatool-$VERSION-macos-arm64
env:
GOOS: darwin
GOARCH: arm64
VERSION: ${{ needs.get_version.outputs.version }}
CGO_CFLAGS: -mmacosx-version-min=10.15
CGO_LDFLAGS: -mmacosx-version-min=10.15
CGO_ENABLED: 1
- run: go build -ldflags="-X github.com/majd/ipatool/v2/cmd.version=$VERSION" -o ipatool-$VERSION-macos-amd64
env:
GOOS: darwin
GOARCH: amd64
VERSION: ${{ needs.get_version.outputs.version }}
CGO_CFLAGS: -mmacosx-version-min=10.15
CGO_LDFLAGS: -mmacosx-version-min=10.15
CGO_ENABLED: 1
- uses: actions/upload-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-windows-arm64.exe
path: ipatool-${{ needs.get_version.outputs.version }}-windows-arm64.exe
if-no-files-found: error
- uses: actions/upload-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-windows-amd64.exe
path: ipatool-${{ needs.get_version.outputs.version }}-windows-amd64.exe
if-no-files-found: error
- uses: actions/upload-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-linux-arm64
path: ipatool-${{ needs.get_version.outputs.version }}-linux-arm64
if-no-files-found: error
- uses: actions/upload-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-linux-amd64
path: ipatool-${{ needs.get_version.outputs.version }}-linux-amd64
if-no-files-found: error
- uses: actions/upload-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
path: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
if-no-files-found: error
- uses: actions/upload-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
path: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
if-no-files-found: error
release_windows:
name: Release for Windows
runs-on: ubuntu-latest
needs: [get_version, build]
strategy:
fail-fast: false
matrix:
arch: [ arm64, amd64 ]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-windows-${{ matrix.arch }}.exe
path: bin
- run: tar -czvf $FILE.tar.gz bin/$FILE.exe
env:
FILE: ipatool-${{ needs.get_version.outputs.version }}-windows-${{ matrix.arch }}
- run: ./tools/sha256sum.sh $TARBALL > $TARBALL.sha256sum
env:
TARBALL: ipatool-${{ needs.get_version.outputs.version }}-windows-${{ matrix.arch }}.tar.gz
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ipatool-${{ needs.get_version.outputs.version }}-windows-${{ matrix.arch }}.*
tag: ${{ github.ref }}
overwrite: false
file_glob: true
release_linux:
name: Release for Linux
runs-on: ubuntu-latest
needs: [get_version, build, release_windows]
strategy:
fail-fast: false
matrix:
arch: [ arm64, amd64 ]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-linux-${{ matrix.arch }}
path: bin
- run: tar -czvf $FILE.tar.gz bin/$FILE
env:
FILE: ipatool-${{ needs.get_version.outputs.version }}-linux-${{ matrix.arch }}
- run: ./tools/sha256sum.sh $TARBALL > $TARBALL.sha256sum
env:
TARBALL: ipatool-${{ needs.get_version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ipatool-${{ needs.get_version.outputs.version }}-linux-${{ matrix.arch }}.*
tag: ${{ github.ref }}
overwrite: false
file_glob: true
release_macos:
name: Release for macOS
runs-on: ubuntu-latest
needs: [get_version, build, release_windows, release_linux]
steps:
- uses: actions/checkout@v2
with:
path: ./ipatool
- uses: actions/download-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
path: bin
- run: tar -czvf $BIN.tar.gz bin/$BIN && rm -rf bin/
env:
BIN: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
- uses: actions/download-artifact@v2
with:
name: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
path: bin
- run: tar -czvf $FILE.tar.gz bin/$FILE && rm -rf bin/
env:
FILE: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
- id: sha256
run: |
SHA256_ARM64=$(./ipatool/tools/sha256sum.sh ipatool-${{ needs.get_version.outputs.version }}-macos-arm64.tar.gz)
SHA256_AMD64=$(./ipatool/tools/sha256sum.sh ipatool-${{ needs.get_version.outputs.version }}-macos-amd64.tar.gz)
echo $SHA256_ARM64 > ipatool-${{ needs.get_version.outputs.version }}-macos-arm64.tar.gz.sha256sum
echo $SHA256_AMD64 > ipatool-${{ needs.get_version.outputs.version }}-macos-amd64.tar.gz.sha256sum
echo ::set-output name=sha256_arm64::$SHA256_ARM64
echo ::set-output name=sha256_amd64::$SHA256_AMD64
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ipatool-${{ needs.get_version.outputs.version }}-macos-*
tag: ${{ github.ref }}
overwrite: false
file_glob: true
- uses: actions/checkout@v2
with:
repository: ${{ secrets.HOMEBREW_REPO }}
ref: main
token: ${{ secrets.GH_TOKEN }}
path: homebrew-repo
- run: |
cd homebrew-repo
sed -i "3s/.*/ sha256 \"$SHA256_ARM64\"/" Casks/ipatool.rb
sed -i "4s/.*/ url \"https:\/\/github.com\/majd\/ipatool\/releases\/download\/v${{ needs.get_version.outputs.version }}\/ipatool-${{ needs.get_version.outputs.version }}-macos-arm64.tar.gz\"/" Casks/ipatool.rb
sed -i "5s/.*/ binary \"bin\/ipatool-${{ needs.get_version.outputs.version }}-macos-arm64\", target: \"ipatool\"/" Casks/ipatool.rb
sed -i "7s/.*/ sha256 \"$SHA256_AMD64\"/" Casks/ipatool.rb
sed -i "8s/.*/ url \"https:\/\/github.com\/majd\/ipatool\/releases\/download\/v${{ needs.get_version.outputs.version }}\/ipatool-${{ needs.get_version.outputs.version }}-macos-amd64.tar.gz\"/" Casks/ipatool.rb
sed -i "9s/.*/ binary \"bin\/ipatool-${{ needs.get_version.outputs.version }}-macos-amd64\", target: \"ipatool\"/" Casks/ipatool.rb
sed -i "12s/.*/ version \"${{ needs.get_version.outputs.version }}\"/" Casks/ipatool.rb
git config --local user.name ${{ secrets.GH_NAME }}
git config --local user.email ${{ secrets.GH_EMAIL }}
git add Casks/ipatool.rb
git commit -m "Update ipatool to v${{ needs.get_version.outputs.version }}"
git push "https://${{ secrets.GH_TOKEN }}@github.com/${{ secrets.HOMEBREW_REPO }}.git" --set-upstream "main"
env:
SHA256_ARM64: ${{ steps.sha256.outputs.sha256_arm64 }}
SHA256_AMD64: ${{ steps.sha256.outputs.sha256_amd64 }}