open source my site #1
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: CI/CD for website | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
compile-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Go 1.22 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' | |
- name: Install dependencies | |
run: go mod download | |
- name: Build | |
run: | |
export CGO_ENABLED=0 GOOS=linux GOARCH=amd64 && | |
go build -ldflags="-s -w" -o dac.ac . | |
- name: Run the server and then close it | |
run: ./dac.ac & sleep 3 && kill $! | |
deploy-site: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Compose | |
run: | | |
sudo docker-compose --version && | |
sudo docker-compose up --build -d dac.ac |