Skip to content

Commit 542deaf

Browse files
committed
First release
1 parent b66bd35 commit 542deaf

File tree

10 files changed

+821
-33
lines changed

10 files changed

+821
-33
lines changed

.github/workflows/announce.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Announce Release
2+
on:
3+
release:
4+
types: [published]
5+
env:
6+
APP: iv
7+
VER: ${{ github.ref_name }}
8+
REPO: ${{ github.repository }}
9+
HOMEBREW_NAME: Kenneth Shaw
10+
HOMEBREW_EMAIL: [email protected]
11+
HOMEBREW_REPO: https://kenshaw:${{ secrets.HOMEBREW_TOKEN }}@github.com/kenshaw/homebrew-iv.git
12+
AUR_NAME: Kenneth Shaw
13+
AUR_EMAIL: [email protected]
14+
AUR_REPO: [email protected]:iv-cli.git
15+
16+
jobs:
17+
bump-aur-package:
18+
name: Bump AUR Package
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Add AUR SSH key
22+
uses: shimataro/ssh-key-action@v2
23+
with:
24+
key: ${{ secrets.AUR_SSH_KEY }}
25+
name: id_ed25519
26+
known_hosts: |
27+
aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN
28+
aur.archlinux.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKF9vAFWdgm9Bi8uc+tYRBmXASBb5cB5iZsB7LOWWFeBrLp3r14w0/9S2vozjgqY5sJLDPONWoTTaVTbhe3vwO8CBKZTEt1AcWxuXNlRnk9FliR1/eNB9uz/7y1R0+c1Md+P98AJJSJWKN12nqIDIhjl2S1vOUvm7FNY43fU2knIhEbHybhwWeg+0wxpKwcAd/JeL5i92Uv03MYftOToUijd1pqyVFdJvQFhqD4v3M157jxS5FTOBrccAEjT+zYmFyD8WvKUa9vUclRddNllmBJdy4NyLB8SvVZULUPrP3QOlmzemeKracTlVOUG1wsDbxknF1BwSCU7CmU6UFP90kpWIyz66bP0bl67QAvlIc52Yix7pKJPbw85+zykvnfl2mdROsaT8p8R9nwCdFsBc9IiD0NhPEHcyHRwB8fokXTajk2QnGhL+zP5KnkmXnyQYOCUYo3EKMXIlVOVbPDgRYYT/XqvBuzq5S9rrU70KoI/S5lDnFfx/+lPLdtcnnEPk=
29+
aur.archlinux.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLMiLrP8pVi5BFX2i3vepSUnpedeiewE5XptnUnau+ZoeUOPkpoCgZZuYfpaIQfhhJJI5qgnjJmr4hyJbe/zxow=
30+
- name: Bump AUR Package
31+
run: |
32+
export WORKDIR=$(mktemp -d /tmp/aur.XXXXXX)
33+
export REPO_PATH=$WORKDIR/aur
34+
wget -O $WORKDIR/archive.tar.gz https://github.com/$REPO/archive/$VER.tar.gz
35+
export SHA256SUM=$(sha256sum $WORKDIR/archive.tar.gz|awk '{print $1}')
36+
export CHANGELOG=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/$REPO/releases/tags/$VER|jq .body|sed -e 's/\\r//g')
37+
git clone $AUR_REPO $REPO_PATH
38+
git -C $REPO_PATH config user.name "$AUR_NAME"
39+
git -C $REPO_PATH config user.email "$AUR_EMAIL"
40+
sed -i "s/pkgver=.*$/pkgver=${VER#v}/" $REPO_PATH/PKGBUILD
41+
sed -i "s/sha256sums=.*$/sha256sums=('$SHA256SUM')/" $REPO_PATH/PKGBUILD
42+
sed -i "s/pkgrel=.*$/pkgrel=1/" $REPO_PATH/PKGBUILD
43+
sed -i "s/pkgver =.*$/pkgver = ${VER#v}/" $REPO_PATH/.SRCINFO
44+
sed -i "s%source =.*$%source = $APP-${VER#v}.tar.gz::https://github.com/$REPO/archive/$VER.tar.gz%" $REPO_PATH/.SRCINFO
45+
sed -i "s/sha256sums =.*$/sha256sums = $SHA256SUM/" $REPO_PATH/.SRCINFO
46+
sed -i "s/pkgrel =.*$/pkgrel = 1/" $REPO_PATH/.SRCINFO
47+
git -C $REPO_PATH add PKGBUILD .SRCINFO
48+
git -C $REPO_PATH commit -m "$(printf %b "Update $APP version to $VER\n\n${CHANGELOG:1:-1}")"
49+
git -C $REPO_PATH show -C
50+
git -C $REPO_PATH push origin master
51+
52+
bump-homebrew-formula:
53+
name: Bump Homebrew Formula
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Bump Homebrew Formula
57+
run: |
58+
export WORKDIR=$(mktemp -d /tmp/homebrew.XXXXXX)
59+
export REPO_PATH=$WORKDIR/homebrew
60+
wget -O $WORKDIR/archive.tar.gz https://github.com/$REPO/archive/$VER.tar.gz
61+
export SHA256SUM=$(sha256sum $WORKDIR/archive.tar.gz|awk '{print $1}')
62+
export CHANGELOG=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/$REPO/releases/tags/$VER|jq .body|sed -e 's/\\r//g')
63+
git clone $HOMEBREW_REPO $REPO_PATH
64+
git -C $REPO_PATH config user.name "$HOMEBREW_NAME"
65+
git -C $REPO_PATH config user.email "$HOMEBREW_EMAIL"
66+
sed -i "s%url \".*$%url \"https://github.com/$REPO/archive/$VER.tar.gz\"%" $REPO_PATH/Formula/$APP.rb
67+
sed -i "s/sha256 \".*$/sha256 \"$SHA256SUM\"/" $REPO_PATH/Formula/$APP.rb
68+
git -C $REPO_PATH add Formula/$APP.rb
69+
git -C $REPO_PATH commit -m "$(printf %b "Update $APP version to $VER\n\n${CHANGELOG:1:-1}")"
70+
git -C $REPO_PATH show -C
71+
git -C $REPO_PATH push origin master
72+
73+
announce-discord:
74+
name: Announce Discord
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Announce Discord
78+
run: |
79+
curl \
80+
-H 'Content-Type: application/json' \
81+
-d '{"username": "'$APP'", "content": "> *'$APP' '$VER'* has been released!\n\nGet it here: https://github.com/'$REPO'/releases/'$VER'"}' \
82+
${{ secrets.DISCORD_WEBHOOK_URL }}

.github/workflows/release.yml

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Release
2+
on: push
3+
env:
4+
APP: iv
5+
VER: ${{ github.ref_name }}
6+
GO_VERSION: stable
7+
8+
jobs:
9+
build_for_linux:
10+
name: Build for Linux
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
arch: [amd64, arm, arm64]
16+
steps:
17+
- name: Install build dependencies
18+
run: |
19+
sudo apt-get -qq update
20+
sudo apt-get install -y \
21+
build-essential \
22+
qemu-user \
23+
gcc-arm-linux-gnueabihf \
24+
g++-arm-linux-gnueabihf \
25+
gcc-aarch64-linux-gnu \
26+
g++-aarch64-linux-gnu \
27+
libstdc++6-armhf-cross \
28+
libstdc++6-arm64-cross \
29+
libc6-dev-armhf-cross \
30+
libc6-dev-arm64-cross \
31+
file
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup Go
35+
uses: actions/setup-go@v4
36+
with:
37+
go-version: ${{ env.GO_VERSION }}
38+
- name: Build ${{ matrix.arch }}
39+
run: |
40+
./build.sh -v $VER -a ${{ matrix.arch }}
41+
- name: Build ${{ matrix.arch }} (static)
42+
if: matrix.arch != 'arm'
43+
run: |
44+
./build.sh -v $VER -a ${{ matrix.arch }} -s
45+
- name: Archive artifacts
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: dist-linux-${{ matrix.arch }}
49+
path: build/linux/**/*
50+
if-no-files-found: error
51+
52+
build_for_macos:
53+
name: Build for macOS
54+
runs-on: macos-latest
55+
strategy:
56+
matrix:
57+
arch: [amd64, arm64]
58+
steps:
59+
- name: Install build dependencies
60+
run: |
61+
brew install coreutils gnu-tar
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
- name: Setup Go
65+
uses: actions/setup-go@v4
66+
with:
67+
go-version: ${{ env.GO_VERSION }}
68+
- name: Build ${{ matrix.arch }}
69+
run: |
70+
./build.sh -v $VER -a ${{ matrix.arch }}
71+
- name: Archive artifacts
72+
uses: actions/upload-artifact@v3
73+
with:
74+
name: dist-darwin-${{ matrix.arch }}
75+
path: build/darwin/**/*
76+
if-no-files-found: error
77+
78+
build_for_macos_universal:
79+
name: Build for macOS (universal)
80+
needs:
81+
- build_for_macos
82+
runs-on: macos-latest
83+
steps:
84+
- name: Install build dependencies
85+
run: |
86+
brew install coreutils gnu-tar
87+
- name: Download artifacts
88+
uses: actions/download-artifact@v3
89+
- name: Build universal
90+
run: |
91+
export WORKDIR=$PWD/build/darwin/universal/$VER
92+
mkdir -p $WORKDIR
93+
94+
gtar -jxvf dist-darwin-amd64/*/*/*.tar.bz2 -C $WORKDIR $APP
95+
gtar -jxvf dist-darwin-amd64/*/*/*.tar.bz2 -C $WORKDIR LICENSE
96+
mv $WORKDIR/$APP $WORKDIR/$APP-amd64
97+
98+
gtar -jxvf dist-darwin-arm64/*/*/*.tar.bz2 -C $WORKDIR $APP
99+
mv $WORKDIR/$APP $WORKDIR/$APP-arm64
100+
101+
file $WORKDIR/$APP-{amd64,arm64}
102+
103+
lipo -create -output $WORKDIR/$APP $WORKDIR/$APP-amd64 $WORKDIR/$APP-arm64
104+
chmod +x $WORKDIR/$APP
105+
file $WORKDIR/$APP
106+
107+
rm $WORKDIR/$APP-{amd64,arm64}
108+
109+
sudo /usr/sbin/purge
110+
111+
gtar -C $WORKDIR -cjf $WORKDIR/$APP-${VER#v}-darwin-universal.tar.bz2 $APP LICENSE
112+
ls -alh $WORKDIR/*
113+
sha256sum $WORKDIR/*
114+
- name: Archive artifacts
115+
uses: actions/upload-artifact@v3
116+
with:
117+
name: dist-darwin-universal
118+
path: build/darwin/**/*
119+
if-no-files-found: error
120+
121+
build_for_windows:
122+
name: Build for Windows
123+
runs-on: windows-latest
124+
steps:
125+
- name: Install build dependencies
126+
run: choco install zip
127+
- name: Checkout
128+
uses: actions/checkout@v4
129+
- name: Setup Go
130+
uses: actions/setup-go@v4
131+
with:
132+
go-version: ${{ env.GO_VERSION }}
133+
- name: Build amd64
134+
shell: bash
135+
run: |
136+
./build.sh -v $VER
137+
- name: Archive artifacts
138+
uses: actions/upload-artifact@v3
139+
with:
140+
name: dist-windows
141+
path: build/windows/**/*
142+
if-no-files-found: error
143+
144+
release:
145+
name: Draft Release
146+
needs:
147+
- build_for_linux
148+
- build_for_macos
149+
- build_for_macos_universal
150+
- build_for_windows
151+
runs-on: ubuntu-latest
152+
steps:
153+
- name: Download artifacts
154+
uses: actions/download-artifact@v3
155+
- name: Release
156+
uses: softprops/action-gh-release@v1
157+
if: startsWith(github.ref, 'refs/tags/v')
158+
with:
159+
name: ${{ env.APP }} ${{ env.VER }}
160+
draft: true
161+
generate_release_notes: true
162+
files: |
163+
dist-*/*/*/*.tar.bz2
164+
dist-*/*/*/*.zip

.github/workflows/test.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on: [push, pull_request]
2+
name: Test
3+
jobs:
4+
test:
5+
name: Build
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Install Go
9+
uses: actions/setup-go@v4
10+
with:
11+
go-version: stable
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
- name: Build
15+
run: |
16+
go build ./...

.gitignore

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
/iv
22
/iv.exe
33

4+
/build
5+
46
*.png
57
*.gif
68
*.jpe?g
79
*.bmp
8-
*.tiff
10+
*.tiff?
911
*.webp
1012
*.pnm
1113
*.heif
14+
15+
*.ttf
16+
*.ttc
17+
*.otf
18+
*.woff
19+
*.woff2
20+
21+
*.txt
22+
*.yml
23+
*.yaml

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2023 Kenneth Shaw
3+
Copyright (c) 2015-2024 Kenneth Shaw
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)