mozhi/.gitea/workflows/push.yml

91 lines
2.7 KiB
YAML
Raw Normal View History

2023-08-30 18:43:57 +05:30
name: mozhi pipeline
2023-08-30 18:24:08 +05:30
on: push
jobs:
2023-08-30 18:43:57 +05:30
push_to_registry:
2023-08-30 18:24:08 +05:30
runs-on: ubuntu-latest
2023-08-30 18:43:57 +05:30
name: Push Docker image to Codeberg docker registry
2023-08-30 18:24:08 +05:30
steps:
2023-09-21 21:58:53 +05:30
- name: Checkout
uses: actions/checkout@v3
2023-09-21 22:04:45 +05:30
2023-09-21 21:58:53 +05:30
- name: Set up QEMU
2023-09-21 22:03:29 +05:30
uses: docker/setup-qemu-action@v2
2023-09-21 22:04:45 +05:30
- name: Install docker
uses: papodaca/install-docker-action@main
2023-09-21 21:58:53 +05:30
- name: Set up Docker Buildx
2023-09-21 22:03:29 +05:30
uses: docker/setup-buildx-action@v2
2023-09-21 22:04:45 +05:30
2023-09-21 21:58:53 +05:30
- name: Login to Docker Hub
2023-09-21 22:03:29 +05:30
uses: docker/login-action@v2
2023-08-30 18:24:08 +05:30
with:
username: aryak
password: ${{ secrets.MOZHI_DOCKER_PASSWORD }}
2023-08-30 18:25:27 +05:30
registry: codeberg.org
2023-09-21 22:04:45 +05:30
2023-08-30 18:43:57 +05:30
- name: Build and push Docker image
2023-09-21 22:03:29 +05:30
uses: docker/build-push-action@v4
2023-08-30 18:24:08 +05:30
with:
2023-08-30 18:43:57 +05:30
context: .
file: ./Dockerfile
2023-08-30 18:24:08 +05:30
push: true
2023-08-30 19:25:32 +05:30
tags: codeberg.org/aryak/mozhi:latest
platforms: linux/amd64, linux/arm64
2023-09-21 22:04:45 +05:30
2023-08-30 19:48:57 +05:30
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 14:15:27 +05:30
export GOPRIVATE=codeberg.org/aryak/libmozhi
2023-08-30 19:48:57 +05:30
go mod download
go run github.com/swaggo/swag/cmd/swag@latest init --parseDependency
2023-08-30 19:48:57 +05:30
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 19:51:50 +05:30
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 19:48:57 +05:30
name: mozhi-linux-arm64
path: mozhi-linux-arm64
2023-08-30 19:51:50 +05:30
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 19:48:57 +05:30
name: mozhi-windows-amd64.exe
path: mozhi-windows-amd64.exe
2023-08-30 19:51:50 +05:30
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 19:48:57 +05:30
name: mozhi-windows-arm64.exe
path: mozhi-windows-arm64.exe
2023-08-30 19:51:50 +05:30
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 19:48:57 +05:30
name: mozhi-darwin-amd64
path: mozhi-darwin-amd64
2023-08-30 19:51:50 +05:30
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
2023-08-30 19:48:57 +05:30
name: mozhi-darwin-arm64
path: mozhi-darwin-arm64