Release and Weekly Build #256
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
name: Release and Weekly Build | |
on: | |
schedule: | |
- cron: "0 0 * * SUN" | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch' | |
required: true | |
default: 'main' | |
tag: | |
description: 'Release Tag' | |
jobs: | |
lint: | |
name: Lint | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: "on" | |
steps: | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.22 | |
id: go | |
- name: Checkout code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Check license headers | |
run: make validate | |
# - name: Run golangci-lint | |
# run: make lint | |
build: | |
name: Cross compile | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: "on" | |
steps: | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.22 | |
id: go | |
- name: Checkout code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Unit test | |
run: make test-unit | |
- name: Cross compile | |
run: make TAG_NAME=${{ github.event.inputs.tag }} package-cross | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: hub-tool-packages | |
path: ./dist/* | |
test: | |
name: Native e2e tests | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
defaults: | |
run: | |
shell: bash | |
env: | |
GO111MODULE: "on" | |
GITHUB_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
steps: | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.22 | |
id: go | |
- name: Checkout code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: dist | |
- name: Extract platform binary | |
run: mv dist/hub-tool-packages/* dist/ && make -f builder.Makefile ci-extract | |
# - name: Run e2e tests | |
# env: | |
# E2E_HUB_USERNAME: ${{ secrets.E2E_HUB_USERNAME }} | |
# E2E_HUB_TOKEN: ${{ secrets.E2E_HUB_TOKEN }} | |
# run: make TAG_NAME=${{ github.event.inputs.tag }} e2e | |
release: | |
name: Do GitHub release | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
needs: [lint, build, test] | |
if: ${{ github.event.inputs.tag != '' }} # don't release if no tag is specified | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: dist | |
- name: Ship it | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "dist/*/*" | |
prerelease: true | |
draft: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.event.inputs.tag }} |