From 2c2ffece2f78c7bbca0f10e6d87a452ae51cd959 Mon Sep 17 00:00:00 2001 From: Walter Scott Date: Sat, 25 May 2024 09:58:04 -0500 Subject: [PATCH] finally --- .github/workflows/simver.yaml | 8 +++- action.yaml | 80 ++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 37 deletions(-) diff --git a/.github/workflows/simver.yaml b/.github/workflows/simver.yaml index 3f96f16..95b6850 100644 --- a/.github/workflows/simver.yaml +++ b/.github/workflows/simver.yaml @@ -47,16 +47,20 @@ with: { go-version: "${{ env.GO_VERSION }}" }, }, { - name: install dependencies, + name: download dependencies, run: "cd __simver__ && go mod download", }, { name: install simver, + run: "cd __simver__ && go install ./cmd/simver_gha", + }, + { + name: run simver, env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}", }, - run: "go run ./__simver__/cmd/simver_gha --read-only=false", + run: "simver_gha --read-only=false", }, ] } }, } diff --git a/action.yaml b/action.yaml index c67b64c..9d63762 100644 --- a/action.yaml +++ b/action.yaml @@ -4,38 +4,48 @@ inputs: { GITHUB_TOKEN: { description: "GitHub token", required: true } } runs: using: "composite" steps: - - name: checkout source code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: print git context - shell: bash - run: "jq . -r <<< '${{ toJson(github) }}' | tee /dev/stderr" - - name: get current action ref - id: get-action-ref - shell: bash - # the value we need is the suggix of the github.action_path variable after the "walteh/simver/" is found - run: "echo '${{ github.action_path }}' | sed -n 's/.*walteh\\/simver\\///p' | xargs -I {} echo 'SIMVER_GITHUB_ACTION_REF={}' >> $GITHUB_ENV" - - name: checkout simver code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - repository: walteh/simver - ref: ${{ env.SIMVER_GITHUB_ACTION_REF }} - path: "__simver__" - - name: get current go version from go.mod - id: go-version - shell: bash - run: 'cat __simver__/go.mod | grep ''go '' | awk ''{print $2}'' | xargs -I {} echo "GO_VERSION={}" >> $GITHUB_ENV' - - name: setup golang - uses: actions/setup-go@v4 - with: - go-version: ${{ env.GO_VERSION }} - - name: install dependencies - shell: bash - run: "cd __simver__ && go mod download" - - name: install simver - shell: bash - env: - GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} - run: "go run ./__simver__/cmd/simver_gha --read-only=false" + - name: checkout source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: print git context + shell: bash + run: "jq . -r <<< '${{ toJson(github) }}' | tee /dev/stderr" + + - name: get current action ref + id: get-action-ref + shell: bash + run: "echo '${{ github.action_path }}' | sed -n 's/.*walteh\\/simver\\///p' | xargs -I {} echo 'SIMVER_GITHUB_ACTION_REF={}' >> $GITHUB_ENV" + + - name: checkout simver code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + repository: walteh/simver + ref: ${{ env.SIMVER_GITHUB_ACTION_REF }} + path: "__simver__" + + - name: get current go version from go.mod + id: go-version + shell: bash + run: 'cat __simver__/go.mod | grep ''go '' | awk ''{print $2}'' | xargs -I {} echo "GO_VERSION={}" >> $GITHUB_ENV' + + - name: setup golang + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: download dependencies + shell: bash + run: "cd __simver__ && go mod download" + + - name: install simver + shell: bash + run: "cd __simver__ && go install ./cmd/simver_gha" + + - name: run simver + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} + run: "simver_gha --read-only=false"