mirror of
https://github.com/hauler-dev/hauler.git
synced 2026-05-20 08:04:15 +00:00
78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.15.x, 1.16.x]
|
|
os: [ubuntu-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Install Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Test
|
|
run: go test ./...
|
|
- name: Run vet & lint
|
|
run: |
|
|
go vet .
|
|
golint .
|
|
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
outputs:
|
|
upload_url: ${{ steps.goreleaser.outputs.upload_url }}
|
|
steps:
|
|
- name: Download release notes utility
|
|
env:
|
|
GH_REL_URL: https://github.com/buchanae/github-release-notes/releases/download/0.2.0/github-release-notes-linux-amd64-0.2.0.tar.gz
|
|
run: cd /tmp && curl -sSL ${GH_REL_URL} | tar xz && sudo mv github-release-notes /usr/local/bin/
|
|
- name: Generate release notes
|
|
run: |
|
|
echo 'CHANGELOG' > /tmp/release.txt
|
|
github-release-notes -org rancherfederal -repo hauler -since-latest-release -include-author >> /tmp/release.txt
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run GoReleaser
|
|
id: goreleaser
|
|
uses: goreleaser/goreleaser-action@v1
|
|
with:
|
|
version: latest
|
|
args: release --release-notes=/tmp/release.txt
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Upload assets
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: hauler
|
|
path: dist/hauler_linux_amd64/hauler
|
|
retention-days: 2
|
|
|
|
create-artifacts:
|
|
runs-on: ubuntu-latest
|
|
needs: create-release
|
|
steps:
|
|
- name: Download Hauler binary
|
|
id: download
|
|
uses: actions/download-artifact@v2
|
|
- name: Run Hauler bundle
|
|
run: hauler bundle
|
|
- name: Upload default package to Release
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs,create-release.outputs.upload_url }}
|
|
asset_path: ${{github.workspace}}/bundle/bundle.tar.gz
|
|
asset_name: bundle.tar.gz
|
|
asset_content_type: application/gzip
|
|
|