Update go-ci-cd.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Golang CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21.4 | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21.4 | |
- name: Deploy to Production | |
run: | | |
# Add deployment steps (e.g., deploying to a server, Docker registry, etc.) | |
# Example: deploy.sh | |
# deploy.sh content: | |
# #!/bin/bash | |
# echo "Deploying to production..." | |
# # Add your deployment logic here | |
env: | |
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} |