Updated dependencies #69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
permissions: | |
id-token: write | |
contents: write | |
checks: write | |
packages: write | |
name: Go Build | |
'on': | |
workflow_dispatch: {} | |
push: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.22 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1.1.1 | |
with: | |
versionSpec: 5.x | |
- id: determine_version | |
name: Determine Version | |
uses: gittools/actions/gitversion/execute@v1.1.1 | |
with: | |
additionalArguments: /overrideconfig mode=Mainline | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: https://ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push latest Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ghcr.io/mcasperson/udl:latest | |
- name: Build and push versioned Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ghcr.io/mcasperson/udl:${{ steps.determine_version.outputs.semVer }} | |
- name: Install Dependencies | |
run: go get ./... | |
shell: bash | |
- name: List Dependencies | |
run: go list -u -m all > dependencies.txt | |
shell: bash | |
- name: Collect Dependencies | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Dependencies | |
path: dependencies.txt | |
- name: List Dependency Updates | |
run: go list -u -m -f "{{if .Update}}{{.}}{{end}}" all > dependencyUpdates.txt | |
shell: bash | |
- name: Collect Dependency Updates | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Dependencies Updates | |
path: dependencyUpdates.txt | |
- name: Test | |
run: | | |
go install gotest.tools/gotestsum@latest; gotestsum --junitfile results.xml -- -v ./... -covermode=count -coverprofile=coverage.out | |
go tool cover -func=coverage.out -o=coverage.out | |
shell: bash | |
- name: Go Coverage Badge | |
uses: tj-actions/coverage-badge-go@v2 | |
with: | |
filename: coverage.out | |
- if: always() | |
name: Report | |
uses: dorny/test-reporter@v1 | |
with: | |
name: Go Tests | |
path: results.xml | |
reporter: java-junit | |
fail-on-error: 'false' | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v17 | |
id: verify-changed-files | |
with: | |
files: README.md | |
- name: Commit changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m "chore: Updated coverage badge." | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ github.token }} | |
branch: ${{ github.head_ref }} | |
- id: create_release | |
name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} | |
release_name: Release ${{ steps.determine_version.outputs.semVer }} Run ${{ github.run_number }} Attempt ${{ github.run_attempt }} | |
draft: 'false' | |
prerelease: 'false' | |
- run: go build -o udl cmd/main.go | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
CGO_ENABLED: 0 | |
- run: go build -o udl_linux_arm64 cmd/main.go | |
env: | |
GOOS: linux | |
GOARCH: arm64 | |
CGO_ENABLED: 0 | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: udl | |
asset_name: udl | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: udl_linux_arm64 | |
asset_name: udl_linux_arm64 | |
asset_content_type: application/octet-stream |