From 6766f3f787e55db99da5dd961769969d77db83fd Mon Sep 17 00:00:00 2001 From: Paramtamtam <7326800+tarampampam@users.noreply.github.com> Date: Sat, 29 Jun 2024 19:55:55 +0400 Subject: [PATCH] =?UTF-8?q?wip:=20=F0=9F=94=95=20temporary=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 72 ++++++++++++++++------------------- .github/workflows/tests.yml | 8 ++-- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27bcb14..3254200 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,48 +8,42 @@ on: types: [published] jobs: - wip: + build: + name: Build for ${{ matrix.os }} (${{ matrix.arch }}) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [linux, darwin] # linux, freebsd, darwin, windows + arch: [amd64] # amd64, 386 steps: - - run: echo WIP + - uses: actions/checkout@v4 + + - uses: gacts/setup-go-with-cache@v1 + with: {go-version-file: go.mod} + + - {uses: gacts/github-slug@v1, id: slug} + + - name: Generate builder values + id: values + run: echo "binary-name=error-pages-${{ matrix.os }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT + + - name: Build application + env: + GOOS: ${{ matrix.os }} + GOARCH: ${{ matrix.arch }} + CGO_ENABLED: 0 + LDFLAGS: -s -w -X gh.tarampamp.am/error-pages/internal/version.version=${{ steps.slug.outputs.version }} + run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/error-pages/ + + - name: Upload binary file to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.values.outputs.binary-name }} + asset_name: ${{ steps.values.outputs.binary-name }} + tag: ${{ github.ref }} -#jobs: -# build: -# name: Build for ${{ matrix.os }} (${{ matrix.arch }}) -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# os: [linux, darwin] # linux, freebsd, darwin, windows -# arch: [amd64] # amd64, 386 -# steps: -# - uses: actions/checkout@v4 -# -# - uses: gacts/setup-go-with-cache@v1 -# with: {go-version-file: go.mod} -# -# - {uses: gacts/github-slug@v1, id: slug} -# -# - name: Generate builder values -# id: values -# run: echo "binary-name=error-pages-${{ matrix.os }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT -# -# - name: Build application -# env: -# GOOS: ${{ matrix.os }} -# GOARCH: ${{ matrix.arch }} -# CGO_ENABLED: 0 -# LDFLAGS: -s -w -X gh.tarampamp.am/error-pages/internal/version.version=${{ steps.slug.outputs.version }} -# run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/error-pages/ -# -# - name: Upload binary file to release -# uses: svenstaro/upload-release-action@v2 -# with: -# repo_token: ${{ secrets.GITHUB_TOKEN }} -# file: ${{ steps.values.outputs.binary-name }} -# asset_name: ${{ steps.values.outputs.binary-name }} -# tag: ${{ github.ref }} -# # docker-image: # name: Build docker image # runs-on: ubuntu-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 85dd29e..78cae9b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,9 +58,11 @@ jobs: CGO_ENABLED: 0 LDFLAGS: -s -w -X gh.tarampamp.am/error-pages/internal/appmeta.version=${{ steps.slug.outputs.commit-hash-short }} run: go build -trimpath -ldflags "$LDFLAGS" -o ./error-pages ./cmd/error-pages/ - - {if: matrix.os == 'linux', run: ./error-pages --version && ./error-pages -h} - - {if: matrix.os == 'linux', run: mkdir ./out && ./error-pages --log-level=debug build --index --target-dir ./out} - - if: matrix.os == 'linux' + - if: matrix.os == 'linux' && matrix.arch == 'amd64' + run: ./error-pages --version && ./error-pages -h + - if: matrix.os == 'linux' && matrix.arch == 'amd64' + run: mkdir ./out && ./error-pages --log-level=debug build --index --target-dir ./out + - if: matrix.os == 'linux' && matrix.arch == 'amd64' run: | test -f ./out/index.html test -f ./out/ghost/404.html