Skip to content

Commit

Permalink
rewrite as bash composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
daaku committed Aug 30, 2023
1 parent c4247e6 commit e385d2e
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 11,145 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
29 changes: 14 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: "build-test"
name: Test
on:
- pull_request
- push

push:
pull_request:
workflow_dispatch:
inputs:
release_version:
description: Custom release version.
required: false
default: ""
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.1.1
- run: |
npm install
npm run all
test:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2.1.3
- uses: actions/setup-go@v4
with:
go-version: '1.15'
- uses: actions/checkout@v2.1.1
go-version: stable
- uses: actions/checkout@v3
- uses: ./
with:
release_version: ${{ github.event.inputs.release_version }}
- name: Env
run: echo $BI_LDFLAGS
- name: Build
Expand Down
99 changes: 0 additions & 99 deletions .gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

10 changes: 0 additions & 10 deletions .prettierrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions __tests__/main.test.ts

This file was deleted.

26 changes: 26 additions & 0 deletions action
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

BUILD_HASH=${GITHUB_SHA:-unknown}
BUILD_TIME_UNIX=$(date +%s)
BUILD_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

if [ -z "$INPUT_RELEASE_VERSION" ]; then
TAGS_PREFIX=refs/tags/
if [[ $GITHUB_REF = $TAGS_PREFIX* ]]; then
INPUT_RELEASE_VERSION=${GITHUB_REF#$TAGS_PREFIX}
elif [ -n "$GITHUB_RUN_NUMBER" ]; then
INPUT_RELEASE_VERSION=v$GITHUB_RUN_NUMBER
else
INPUT_RELEASE_VERSION=unknown
fi
fi

ldflags=(
"-X github.com/daaku/buildinfo.buildHash=$BUILD_HASH"
"-X github.com/daaku/buildinfo.buildTimeUnix=$BUILD_TIME_UNIX"
"-X github.com/daaku/buildinfo.buildURL=$BUILD_URL"
"-X github.com/daaku/buildinfo.releaseVersion=$INPUT_RELEASE_VERSION"
)

IFS=' ' eval 'joined_ldflags="${ldflags[*]}"'
echo "BI_LDFLAGS=$joined_ldflags" >>$GITHUB_ENV
6 changes: 4 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ inputs:
release_version:
description: 'Specify release version to use. Automatically determined if unset.'
runs:
using: 'node12'
main: 'dist/index.js'
using: composite
steps:
- run: ${{ github.action_path }}/action
shell: bash

0 comments on commit e385d2e

Please sign in to comment.