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 e12ee8d
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 11,146 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

21 changes: 5 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
name: "build-test"
on:
- pull_request
- push

name: Test
on: [push, pull_request]
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: ./
- name: Env
run: echo $BI_LDFLAGS
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 [[ $INPUT_RELEASE_VERSION == "" ]]; then
TAGS_PREFIX=refs/tags/
if [[ $GITUB_REF = "$TAGS_PREFIX*" ]]; then
INPUT_RELEASE_VERSION=${GITHUB_REF#$TAGS_PREFIX}
elif [ -n "$GITUB_RUN_NUMBER" ]; then
INPUT_RELEASE_VERSION=v$GITUB_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 e12ee8d

Please sign in to comment.