Skip to content

Commit

Permalink
updating goreleaser-cross to use latest release image and setting up …
Browse files Browse the repository at this point in the history
…reusable workflow for pages
  • Loading branch information
shibme committed Aug 28, 2024
1 parent e0af926 commit 947b7ba
Show file tree
Hide file tree
Showing 9 changed files with 9,786 additions and 15,708 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: Publish Web Pages
name: Publish Xipher Web

on:
push:
branches: ["main"]
workflow_dispatch:
workflow_call:
inputs:
ref:
type: string
description: 'The branch, tag or SHA of shibme/xipher to publish'
default: ${{ github.ref }}

jobs:

pages:
name: Deploy to GitHub Pages
name: Deploy Xipher Web to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -23,23 +29,27 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: shibme/xipher
ref: ${{ inputs.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Install dependencies
run: npm -C web ci
- name: Build Xipher Web
run: npm -C web run build
- name: Download wasm files from latest release
uses: robinraju/release-downloader@v1.10
uses: robinraju/release-downloader@v1.11
with:
repository: shibme/xipher
latest: true
fileName: '*wasm*'
- name: Add WASM files to build directory
run: |
mkdir -p web/build/wasm
unzip xipher_js_wasm.zip -d web/build/wasm/
- name: Setup Pages
uses: actions/configure-pages@v4
uses: actions/configure-pages@v5
- name: Upload artifact from web/build
uses: actions/upload-pages-artifact@v3
with:
Expand Down
57 changes: 7 additions & 50 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ jobs:

test:
name: Running Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Test
run: go test -v .
uses: ./.github/workflows/test.yaml
secrets: inherit

release:
name: Release
Expand All @@ -36,9 +29,6 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Preparing GoReleaser Builder
run: |
docker build -t goreleaser:local -f Dockerfile.goreleaser .
- name: Copy wasm_exec.js to project root
run: |
docker run --rm \
Expand All @@ -47,7 +37,7 @@ jobs:
-e GITHUB_TOKEN \
-e HOMEBREW_SSH_KEY \
--entrypoint sh \
goreleaser:local \
ghcr.io/goreleaser/goreleaser-cross:latest \
-c "cp \$(go env GOROOT)/misc/wasm/wasm_exec.js ./"
- name: GoReleaser - Release Xipher
run: |
Expand All @@ -56,7 +46,7 @@ jobs:
-v $PWD:/workspace \
-e GITHUB_TOKEN \
-e HOMEBREW_SSH_KEY \
goreleaser:local \
ghcr.io/goreleaser/goreleaser-cross:latest \
release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -83,43 +73,10 @@ jobs:
ghcr.io/${{ github.repository }}:${{ env.XIPHER_VERSION }}
pages:
name: Deploy to GitHub Pages
name: Run GitHub Pages Workflow
needs: release
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Install dependencies
run: npm -C web ci
- name: Build Xipher Web
run: npm -C web run build
- name: Download wasm files from latest release
uses: robinraju/[email protected]
with:
latest: true
fileName: '*wasm*'
- name: Add WASM files to build directory
run: |
mkdir -p web/build/wasm
unzip xipher_js_wasm.zip -d web/build/wasm/
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact from web/build
uses: actions/upload-pages-artifact@v3
with:
path: web/build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: ./.github/workflows/pages.yaml
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:

jobs:
test:
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.goreleaser

This file was deleted.

8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ go 1.21
toolchain go1.22.2

require (
github.com/cloudflare/circl v1.3.9
github.com/cloudflare/circl v1.4.0
github.com/fatih/color v1.17.0
github.com/spf13/cobra v1.8.1
golang.org/x/crypto v0.25.0
golang.org/x/term v0.22.0
golang.org/x/crypto v0.26.0
golang.org/x/term v0.23.0
)

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE=
github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY=
github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
Expand All @@ -15,13 +15,13 @@ github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading

0 comments on commit 947b7ba

Please sign in to comment.