Skip to content

Commit

Permalink
Complete rewrite of github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenlj committed Sep 17, 2021
1 parent 98b4ebe commit dab55d6
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 149 deletions.
28 changes: 0 additions & 28 deletions .github/release-drafter.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/build-release.yml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build
on: push

jobs:
set-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: set version
id: set-version
run: |
echo Faking a Semantic Version
echo ::set-output name=version::1.$(date "+%Y%m%d.%H%M%S")
build:
needs:
- set-version
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Test Go
run: |
go mod tidy -v
go test ./... -count=1 -coverprofile cover.out -short
release-candidate:
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- set-version
- build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout latest code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Create tag
run: |
git tag ${{ needs.set-version.outputs.version }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release -f .goreleaser.yml --rm-dist

- name: Add new deb to ppa
id: update_ppa
env:
VERSION: ${{ needs.set-version.outputs.version }}
PUSH_KEY: ${{ secrets.SRVNAIS_REPO_PUSH_PAT }}
EMAIL: aura@nav.no
run: |
echo "Version ${VERSION} was released, adding to PPA"
eval "$(ssh-agent -s)"
ssh-add - <<< "${PUSH_KEY}"
git clone git@github.com:nais/nais-ppa.git pparepo
cd pparepo
# Fetch latest deb
wget https://github.com/${{ github.repository }}/releases/download/${VERSION}/nais-d_${VERSION}.deb
# Commit and push changes
git config user.email "${EMAIL}"
git config user.name "nais-d pipeline"
git add nais-d_${VERSION}.deb
git --no-pager diff --cached
git commit --all --message "Add version ${VERSION} of nais-d"
git push
46 changes: 0 additions & 46 deletions .github/workflows/commit-master.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/release-master.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
project_name: nais-d
builds:
- env: [CGO_ENABLED=0, VERSION=v0.0.2]
- env: [CGO_ENABLED=0]
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
id: "nais-d"
dir: .
main: ./main/nais_d
Expand All @@ -25,6 +26,8 @@ release:
github:
owner: nais
name: nais-d
header: |
## nais-d ({{ .Version }})
brews:
- tap:
owner: nais
Expand Down

0 comments on commit dab55d6

Please sign in to comment.