Skip to content

Commit

Permalink
chore: use GopherJS to build JavaScript Action
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Aug 4, 2022
1 parent 25d24f8 commit e32a6b3
Show file tree
Hide file tree
Showing 15 changed files with 149,050 additions and 98 deletions.
5 changes: 5 additions & 0 deletions .cmdx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ tasks:
description: lint the go code
usage: lint the go code
script: golangci-lint run
- name: build
short: b
description: Build action by GopherJS
usage: Build action by GopherJS
script: gopherjs build -o dist/index.js ./cmd/action
- name: release
short: r
description: release the new version
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/test-actions-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: test-actions-windows
on:
push:
branches: [main]
tags: [v*]
pull_request:
branches: [main]
jobs:
test-actions-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
aqua_version: v1.18.0
working_directory: tests
- run: command -v aqua
- run: aqua -v
- run: github-comment -v
working-directory: tests
test-actions-windows-absolute-path:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
aqua_version: v1.18.0
install_path: /tmp/bin/aqua.exe
working_directory: tests
- run: /tmp/bin/aqua -v
test-actions-windows-relative-path:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
aqua_version: v1.18.0
install_path: bin/aqua.exe
working_directory: tests
- run: tests/bin/aqua -v
24 changes: 3 additions & 21 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Install aqua
description: Install aqua https://aquaproj.github.io/ and install toos with aqua
inputs:
aqua_version:
description: installed aqua's version (e.g. v0.8.7)
description: installed aqua's version (e.g. v1.17.0)
required: true
install_path:
description: aqua's install path
Expand All @@ -17,23 +17,5 @@ inputs:
required: false
default: ""
runs:
using: composite
steps:
- run: |
echo "::error ::aqua_version is required. https://github.com/aquaproj/aqua-installer"
exit 1
shell: bash
if: inputs.aqua_version == ''
- run: echo "${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin" >> $GITHUB_PATH
shell: bash
working-directory: ${{ inputs.working_directory }}
if: inputs.enable_aqua_install == 'true'

- run: bash "${{github.action_path}}/action.sh"
working-directory: ${{ inputs.working_directory }}
shell: bash
env:
AQUA_INSTALL_PATH: ${{ inputs.install_path }}
AQUA_VERSION: ${{ inputs.aqua_version }}
AQUA_OPTS: ${{ inputs.aqua_opts }}
using: node16
main: dist/index.js
3 changes: 3 additions & 0 deletions aqua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ packages:
- name: reviewdog/[email protected]
- name: suzuki-shunsuke/[email protected]
- name: golangci/[email protected]
- name: golang/go
# GopherJS 1.17.2+go1.17.9 requires a Go 1.17.x distribution
version: go1.17.13
24 changes: 24 additions & 0 deletions cmd/action/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"log"

"github.com/aquaproj/aqua-installer/pkg/action"
"github.com/aquaproj/aqua-installer/pkg/api"
)

var (
version = ""
commit = "" //nolint:gochecknoglobals
date = "" //nolint:gochecknoglobals
)

func main() {
if err := action.Run(&api.LDFlags{
Version: version,
Commit: commit,
Date: date,
}); err != nil {
log.Fatal(err)
}
}
Loading

0 comments on commit e32a6b3

Please sign in to comment.