Skip to content

Bump github.com/spf13/cobra from 1.8.0 to 1.8.1 #486

Bump github.com/spf13/cobra from 1.8.0 to 1.8.1

Bump github.com/spf13/cobra from 1.8.0 to 1.8.1 #486

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/publish-go-tester-task.md
name: Publish Tester Build
env:
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
GO_VERSION: "1.17"
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
on:
create:
push:
paths:
- ".github/workflows/publish-go-tester-task.ya?ml"
- "go.mod"
- "go.sum"
- "Taskfile.ya?ml"
- "**.go"
pull_request:
paths:
- ".github/workflows/publish-go-tester-task.ya?ml"
- "go.mod"
- "go.sum"
- "Taskfile.ya?ml"
- "**.go"
workflow_dispatch:
repository_dispatch:
jobs:
run-determination:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.determination.outputs.result }}
permissions: {}
steps:
- name: Determine if the rest of the workflow should run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
TAG_REGEX="refs/tags/.*"
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
if [[
("${{ github.event_name }}" != "create" ||
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX) &&
! "${{ github.ref }}" =~ $TAG_REGEX
]]; then
# Run the other jobs.
RESULT="true"
else
# There is no need to run the other jobs.
RESULT="false"
fi
echo "result=$RESULT" >> $GITHUB_OUTPUT
build:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
echo "BUILD_ARCHIVE_PATH=${{ runner.temp }}/libraries-repository-engine_${{ github.sha }}_Linux_64bit.zip" \
>> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Build application
run: task go:build
# actions/upload-artifact does not maintain file permissions. Putting the executable in an archive avoids the
# application becoming non-executable.
- name: Archive build
run: |
zip \
-j \
"${{ env.BUILD_ARCHIVE_PATH }}" \
"./libraries-repository-engine" \
"./LICENSE.txt"
- name: Save binary as workflow artifact
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: ${{ env.BUILD_ARCHIVE_PATH }}
name: libraries-repository-engine