Skip to content

Commit

Permalink
feat: add source as release assets through workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorian committed Aug 11, 2023
1 parent 37286e2 commit 252e34e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/go.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go
name: build

on:
push:
Expand Down Expand Up @@ -42,3 +42,21 @@ jobs:
run: go test -v ./...
env:
GOPATH: /home/runner/work/url-shortener/url-shortener/src

- name: Build
run: |
GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o bin/app-amd64.exe .
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o bin/app-amd64-linux .
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o bin/app-amd64-darwin .
env:
GOPATH: /home/runner/work/url-shortener/url-shortener/src

- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
bin/app-amd64.exe
bin/app-amd64-linux
bin/app-amd64-darwin
LICENSE.txt
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ on:

jobs:
build:
uses: dorianneto/url-shortener/.github/workflows/go.yml@main
uses: dorianneto/url-shortener/.github/workflows/build.yml@main
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
needs: build
permissions:
contents: write

steps:
- name: Download dist artifact
uses: actions/download-artifact@v3
with:
name: dist
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
LICENSE.txt
*-darwin
*-linux
*.exe
bin/app-amd64.exe
bin/app-amd64-linux
bin/app-amd64-darwin

0 comments on commit 252e34e

Please sign in to comment.