Building binary releases #23
This file contains hidden or 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: Building binary releases | |
| on: | |
| workflow_dispatch | |
| permissions: | |
| contents: write | |
| env: | |
| SHELL: /bin/bash | |
| RELEASE_FILE: "/tmp/medium.rip/medium.rip" | |
| HASH_VALUE: "/tmp/medium.rip.sha256" | |
| PNPM_BIN: "/github/home/.local/share/pnpm/pnpm" | |
| #PNPM_BIN="/home/runner/.local/share/pnpm/pnpm" | |
| FORKREPO: "https://github.com/mycodedoesnotcompile2/medium.rip.git" | |
| ROOT_DIR: "/tmp/medium.rip/" | |
| jobs: | |
| build_pkg: | |
| runs-on: ubuntu-latest | |
| container: golang:bookworm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install prerequisites | |
| run: | | |
| cd /tmp/ | |
| APT_PARAMS='apt -y -qq -o=Dpkg::Use-Pty=0' | |
| $APT_PARAMS update | |
| curl -fsSL https://get.pnpm.io/install.sh | sh - | |
| curl -fsSL https://deb.nodesource.com/setup_22.x | sh - | |
| $APT_PARAMS install sudo curl git nodejs file | |
| - name: Build | |
| run: | | |
| cd /tmp/ | |
| RELEASE_DATE="$(date '+%Y%m%d')" | |
| echo "RELEASE_DATE=$RELEASE_DATE" >> $GITHUB_ENV | |
| git clone "$FORKREPO" medium.rip | |
| cd "$ROOT_DIR/frontend/" | |
| #mv postcss.config.ts postcss.config.cjs | |
| $PNPM_BIN i | |
| $PNPM_BIN approve-builds | |
| $PNPM_BIN run build | |
| cd "$ROOT_DIR" | |
| go mod download | |
| go build -ldflags='-w -s -extldflags "-static"' . | |
| ls -alh $RELEASE_FILE && file $RELEASE_FILE && chmod o+x $RELEASE_FILE | |
| sha256sum --tag $RELEASE_FILE | tee -a $HASH_VALUE | |
| - name: Create a new Github release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: ${{ env.HASH_VALUE }} | |
| name: ${{ env.RELEASE_DATE }} | |
| tag_name: ${{ env.RELEASE_DATE }} | |
| files: | | |
| ${{ env.RELEASE_FILE }} |