Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a4579b399e | |||
| 7be52a79d6 | |||
| 5f2e956e80 | |||
| 242137d421 | |||
| 0c2b7ae461 | |||
| bb4d1439cf |
69
.github/workflows/build.yml
vendored
69
.github/workflows/build.yml
vendored
@@ -4,31 +4,60 @@ on:
|
|||||||
tags: '*'
|
tags: '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare:
|
prepare-data:
|
||||||
name: Prepare Data
|
name: Prepare Data
|
||||||
id: prepare
|
|
||||||
run: |
|
|
||||||
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
|
|
||||||
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
|
|
||||||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: GitHub Package Registry
|
|
||||||
id: ghpr
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
outputs:
|
||||||
SOURCE_NAME: ${{ steps.prepare.outputs.SOURCE_NAME }}
|
tag: ${{ steps.prepare.outputs.SOURCE_TAG }}
|
||||||
SOURCE_BRANCH: ${{ steps.prepare.outputs.SOURCE_BRANCH }}
|
repo: ${{ steps.prepare.outputs.REPO }}
|
||||||
SOURCE_TAG: ${{ steps.prepare.outputs.SOURCE_TAG }}
|
lrepo: ${{ steps.prepare.outputs.LREPO }}
|
||||||
|
steps:
|
||||||
|
- id: prepare
|
||||||
|
name: Prepare environment variables
|
||||||
|
run: |
|
||||||
|
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
|
||||||
|
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
|
||||||
|
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
||||||
|
echo ::set-output name=REPO::${GITHUB_REPOSITORY#luketainton/}
|
||||||
|
echo ::set-output name=LREPO::${GITHUB_REPOSITORY#luketainton/} | tr '[:upper:]' '[:lower:]'
|
||||||
|
|
||||||
|
docker:
|
||||||
|
name: GitHub Package Registry
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [prepare-data]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Login to GitHub Package Registry
|
- name: Login to GitHub Package Registry
|
||||||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u luketainton --password-stdin
|
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u luketainton --password-stdin
|
||||||
- name: Build image for GitHub Package Registry
|
- name: Build image for GitHub Package Registry
|
||||||
run: |
|
run: docker build . --file Dockerfile --tag ghcr.io/luketainton/${{ needs.prepare-data.outputs.lrepo }}:${{ needs.prepare-data.outputs.tag }} --tag ghcr.io/luketainton/${{ needs.prepare-data.outputs.lrepo }}:latest
|
||||||
docker build . --file Dockerfile --tag docker.pkg.github.com/luketainton/ipilot/ipilot:latest
|
|
||||||
docker build . --file Dockerfile --tag docker.pkg.github.com/luketainton/ipilot/ipilot:$SOURCE_TAG
|
|
||||||
- name: Push image to GitHub Package Registry
|
- name: Push image to GitHub Package Registry
|
||||||
run: |
|
run: |
|
||||||
docker push docker.pkg.github.com/luketainton/ipilot/ipilot:latest
|
docker push ghcr.io/luketainton/${{ needs.prepare-data.outputs.lrepo }}:latest
|
||||||
docker push docker.pkg.github.com/luketainton/ipilot/ipilot:$SOURCE_TAG
|
docker push ghcr.io/luketainton/${{ needs.prepare-data.outputs.lrepo }}:${{ needs.prepare-data.outputs.tag }}
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build and Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [prepare-data]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build artifacts
|
||||||
|
run: |
|
||||||
|
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=amd64 -e GOOS=darwin golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-darwin-amd64
|
||||||
|
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=arm64 -e GOOS=darwin golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-darwin-arm64
|
||||||
|
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=amd64 -e GOOS=linux golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-linux-amd64
|
||||||
|
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=amd64 -e GOOS=windows golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-win-amd64.exe
|
||||||
|
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=386 -e GOOS=windows golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-win-x86.exe
|
||||||
|
- uses: meeDamian/github-release@v2.0.3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: ${{ needs.prepare-data.outputs.tag }}
|
||||||
|
gzip: false
|
||||||
|
files: >
|
||||||
|
${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-darwin-amd64
|
||||||
|
${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-darwin-arm64
|
||||||
|
${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-linux-amd64
|
||||||
|
${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-win-amd64.exe
|
||||||
|
${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-win-x86.exe
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user