-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github build and release workflows
- Loading branch information
1 parent
e85de89
commit 9f6fbc2
Showing
2 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Go package | ||
|
||
on: [push] | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
|
||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.x | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v5 | ||
with: | ||
version: v1.57 | ||
|
||
- name: Install Dependencies | ||
run: go get . | ||
|
||
- name: Lint | ||
run: go build -o service main.go | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
|
||
- name: Build | ||
run: go build -o service main.go |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: tag-release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
tag: | ||
if: ${{ github.repository == 'gregfurman/pipescope' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: /usr/bin/git config --global user.email [email protected] | ||
- run: /usr/bin/git config --global user.name 'GitHub Actions Release Tagger' | ||
- run: hack/tag-release.sh | ||
id: tag_release | ||
outputs: | ||
release_tag: ${{ steps.tag_release.outputs.release_tag }} | ||
|
||
release: | ||
needs: tag | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get previous tag | ||
id: prev_tag | ||
run: echo "::set-output name=PREV_TAG::$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))" | ||
|
||
- name: Get commit log | ||
id: commit_log | ||
run: echo "::set-output name=COMMIT_LOG::$(git log --pretty=format:'- %s (%h)' ${PREV_TAG}..HEAD)" | ||
|
||
- name: Setup Golang | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.21.x | ||
|
||
- name: Build Go Binary | ||
run: | | ||
GOOS=linux GOARCH=amd64 go build -o pipescope main.go | ||
- uses: actions/upload-artifact@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ecr-credential-provider | ||
path: ecr-credential-provider | ||
|
||
- uses: actions/create-release@v1 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.tag.outputs.release_tag }} | ||
release_name: ${{ needs.tag.outputs.release_tag }} | ||
body: | | ||
Changes in this release: | ||
${{ steps.commit_log.outputs.COMMIT_LOG }} | ||
draft: false | ||
prerelease: false | ||
|
||
- uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./pipescope | ||
asset_name: pipescope | ||
asset_content_type: application/octet-stream |