chore: Update Cache-Control max-age to 3 seconds for improved caching #85
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: Pre-Release on Push | |
on: | |
push: | |
branches: | |
- "dev" | |
paths-ignore: | |
- "README.md" | |
- "LICENSE" | |
- "package.json" | |
- "package-lock.json" | |
- "tailwind.config.js" | |
- ".gitignore" | |
- ".dockerignore" | |
- "Dockerfile" | |
- "scripts/**" | |
- "**.sh" | |
- "docs/**" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }}-pre-release | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
pre-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go π¦ | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "go.mod" | |
- name: Setup android NDK | |
run: | | |
wget -q --show-progress https://dl.google.com/android/repository/android-ndk-r26b-linux.zip | |
unzip -qq android-ndk-r26b-linux.zip | |
echo "$PWD/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH | |
- name: Build Executables ποΈ π | |
run: | | |
mkdir -p bin | |
allowed_archs="amd64 arm arm64 386" | |
for var in $(go tool dist list); do | |
# skip disallowed archs | |
if [[ ! $allowed_archs =~ "$(cut -d '/' -f 2 <<<$var)" ]]; then | |
echo "Skipping: $var" | |
continue | |
fi | |
# skip arm for windows | |
if [[ "$(cut -d '/' -f 1 <<<$var)" == "windows" && "$(cut -d '/' -f 2 <<<$var)" == "arm" ]]; then | |
echo "Skipping: $var (windows/arm)" | |
continue | |
fi | |
file_name="jiotv_go-$(cut -d '/' -f 1 <<< $var)-$(cut -d '/' -f 2 <<< $var)" | |
case "$(cut -d '/' -f 1 <<< $var)" in | |
"windows") | |
echo "Building $var" | |
CGO_ENABLED=0 GOOS="$(cut -d '/' -f 1 <<< $var)" GOARCH="$(cut -d '/' -f 2 <<< $var)" go build -o bin/"$file_name.exe" -trimpath -ldflags="-s -w" . & | |
;; | |
"linux" | "darwin") | |
echo "Building $var" | |
CGO_ENABLED=0 GOOS="$(cut -d '/' -f 1 <<< $var)" GOARCH="$(cut -d '/' -f 2 <<< $var)" go build -o bin/"$file_name" -trimpath -ldflags="-s -w" . & | |
;; | |
"android") | |
echo "Building $var" | |
case "$(cut -d '/' -f 2 <<<$var)" in | |
"arm") | |
CGO_ENABLED=1 GOOS="$(cut -d '/' -f 1 <<<$var)" GOARCH="$(cut -d '/' -f 2 <<<$var)" CC="armv7a-linux-androideabi28-clang" CXX="armv7a-linux-androideabi28-clang++" go build -o bin/"jiotv_go-$(cut -d '/' -f 1 <<<$var)-$(cut -d '/' -f 2 <<<$var)" -trimpath -ldflags="-s -w" . | |
;; | |
"arm64") | |
CGO_ENABLED=1 GOOS="$(cut -d '/' -f 1 <<<$var)" GOARCH="$(cut -d '/' -f 2 <<<$var)" CC="aarch64-linux-android32-clang" CXX="aarch64-linux-android32-clang++" go build -o bin/"jiotv_go-$(cut -d '/' -f 1 <<<$var)-$(cut -d '/' -f 2 <<<$var)" -trimpath -ldflags="-s -w" . | |
;; | |
"amd64") | |
CGO_ENABLED=1 GOOS="$(cut -d '/' -f 1 <<<$var)" GOARCH="$(cut -d '/' -f 2 <<<$var)" CC="x86_64-linux-android32-clang" CXX="x86_64-linux-android32-clang++" go build -o bin/"jiotv_go-$(cut -d '/' -f 1 <<<$var)-$(cut -d '/' -f 2 <<<$var)" -trimpath -ldflags="-s -w" . | |
;; | |
*) | |
echo "Skipping: $var" | |
;; | |
esac | |
;; | |
*) | |
echo "Skipping: $var" | |
;; | |
esac | |
done | |
# Wait for all background jobs to finish | |
wait | |
- name: Delete previous release ποΈ | |
run: | | |
tag=$(git describe --tags --match "${{ github.ref_name }}.[0-9]*.[0-9]*.[0-9]*" --abbrev=0) | |
gh release delete -y $tag --cleanup-tag | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate tag | |
id: gen_tag | |
run: | | |
echo "tag=${{ github.ref_name }}.$(date +'%Y.%m.%d.%H.%M.%s')" >> $GITHUB_OUTPUT | |
- name: Release π¦ | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: true | |
tag_name: ${{ steps.gen_tag.outputs.tag }} | |
files: | | |
./bin/* | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |