mozhi/.gitea/workflows/push.yml
2023-09-21 22:05:59 +05:30

90 lines
2.7 KiB
YAML

name: mozhi pipeline
on: push
jobs:
push_to_registry:
runs-on: ubuntu-latest
name: Push Docker image to Codeberg docker registry
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install docker
uses: papodaca/install-docker-action@main
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: aryak
password: ${{ secrets.MOZHI_DOCKER_PASSWORD }}
registry: codeberg.org
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: codeberg.org/aryak/mozhi:latest
platforms: linux/amd64, linux/arm64
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: |
export GOPRIVATE=codeberg.org/aryak/libmozhi
go mod download
go run github.com/swaggo/swag/cmd/swag@latest init --parseDependency
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
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mozhi-linux-arm64
path: mozhi-linux-arm64
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mozhi-windows-amd64.exe
path: mozhi-windows-amd64.exe
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mozhi-windows-arm64.exe
path: mozhi-windows-arm64.exe
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mozhi-darwin-amd64
path: mozhi-darwin-amd64
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mozhi-darwin-arm64
path: mozhi-darwin-arm64