mozhi/.gitea/workflows/push.yml

83 lines
2.6 KiB
YAML
Raw Normal View History

2023-08-30 13:13:57 +00:00
name: mozhi pipeline
2023-08-30 12:54:08 +00:00
on: push
jobs:
2023-08-30 13:13:57 +00:00
push_to_registry:
2023-08-30 12:54:08 +00:00
runs-on: ubuntu-latest
2023-08-30 13:13:57 +00:00
name: Push Docker image to Codeberg docker registry
2023-08-30 12:54:08 +00:00
steps:
2023-08-30 13:13:57 +00:00
- name: Check out the repo
2023-08-30 13:55:32 +00:00
uses: actions/checkout@v3
2023-08-30 13:22:16 +00:00
2023-08-30 13:59:30 +00:00
- name: Install docker
uses: papodaca/install-docker-action@main
2023-08-30 13:22:16 +00:00
- name: Log in to registry
2023-08-30 13:55:32 +00:00
uses: docker/login-action@v2
2023-08-30 12:54:08 +00:00
with:
username: aryak
password: ${{ secrets.MOZHI_DOCKER_PASSWORD }}
2023-08-30 12:55:27 +00:00
registry: codeberg.org
2023-08-30 13:13:57 +00:00
- name: Build and push Docker image
2023-08-30 13:55:32 +00:00
uses: docker/build-push-action@v4
2023-08-30 12:54:08 +00:00
with:
2023-08-30 13:13:57 +00:00
context: .
file: ./Dockerfile
2023-08-30 12:54:08 +00:00
push: true
2023-08-30 13:55:32 +00:00
tags: codeberg.org/aryak/mozhi:latest
2023-08-30 14:18:57 +00:00
build_artifact:
runs-on: ubuntu-latest
name: Build and publish artifacts
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Setup Go compiler
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build mozhi
run: |
2023-09-11 08:45:27 +00:00
export GOPRIVATE=codeberg.org/aryak/libmozhi
2023-08-30 14:18:57 +00:00
go mod download
go run github.com/swaggo/swag/cmd/swag@latest init --parseDependency
2023-08-30 14:18:57 +00:00
GOOS=linux GOARCH=amd64 go build -o mozhi-linux-amd64
GOOS=linux GOARCH=arm64 go build -o mozhi-linux-arm64
GOOS=windows GOARCH=amd64 go build -o mozhi-windows-amd64.exe
GOOS=windows GOARCH=arm64 go build -o mozhi-windows-arm64.exe
GOOS=darwin GOARCH=amd64 go build -o mozhi-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -o mozhi-darwin-arm64
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mozhi-linux-amd64
path: mozhi-linux-amd64
2023-08-30 14:21:50 +00:00
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 14:18:57 +00:00
name: mozhi-linux-arm64
path: mozhi-linux-arm64
2023-08-30 14:21:50 +00:00
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 14:18:57 +00:00
name: mozhi-windows-amd64.exe
path: mozhi-windows-amd64.exe
2023-08-30 14:21:50 +00:00
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 14:18:57 +00:00
name: mozhi-windows-arm64.exe
path: mozhi-windows-arm64.exe
2023-08-30 14:21:50 +00:00
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 14:18:57 +00:00
name: mozhi-darwin-amd64
path: mozhi-darwin-amd64
2023-08-30 14:21:50 +00:00
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 14:18:57 +00:00
name: mozhi-darwin-arm64
path: mozhi-darwin-arm64