Skip to content

Update workflow-sample2.yml #10

Update workflow-sample2.yml

Update workflow-sample2.yml #10

name: Simple Go Build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go version
uses: actions/setup-go@v5
with:
go-version: '1.22.0'
- name: run go
run: go run hello.go
- name: build go
run: go build -o build/hello hello.go
- name: Upload Go binary as artifact
uses: actions/upload-artifact@v4
with:
name: hello-binary
path: build/hello
test:
name: Test
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Set Test
id: set-test-stage
run: echo ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
dev:
name: Dev
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Set Dev
id: set-dev-stage
run: echo ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run:
name: Run
needs: [ test, dev ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Go binary artifact
uses: actions/download-artifact@v4
with:
name: hello-binary
path: build/
- name: Set execute permission
run: chmod +x build/hello
- name: Run Go binary
run: ./build/hello
- uses: actions/checkout@v3
- uses: ncipollo/release-action@v1
with:
bodyFile: "README.md"