chore: migrate workflows to gitea
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
name: Deploy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.gitignore'
|
||||
- '**/*/LICENSE.md'
|
||||
- '**/*/README.md'
|
||||
- '**/*/Dockerfile'
|
||||
jobs:
|
||||
build:
|
||||
name: Build and push Docker image
|
||||
runs-on: ubuntu-24.04-arm
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Create version tag
|
||||
id: version
|
||||
run: echo "version=$(date +%Y.%m.%d.%H%M%S)" >> $GITHUB_OUTPUT
|
||||
- name: Build and push server image
|
||||
run: |
|
||||
TAG=${{ secrets.DOCKERHUB_USERNAME }}/links.stevanfreeborn.com:${{ steps.version.outputs.version }}
|
||||
docker build -t $TAG .
|
||||
docker push $TAG
|
||||
deploy:
|
||||
name: Deploy to server
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Run deploy script
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
script: |
|
||||
TAG=${{ secrets.DOCKERHUB_USERNAME }}/links.stevanfreeborn.com:${{ needs.build.outputs.version }}
|
||||
|
||||
docker stop links.stevanfreeborn.com
|
||||
docker rm links.stevanfreeborn.com
|
||||
|
||||
docker pull $TAG
|
||||
docker run \
|
||||
--restart always \
|
||||
-d \
|
||||
-p 7777:7777 \
|
||||
--name links.stevanfreeborn.com \
|
||||
$TAG
|
||||
@@ -0,0 +1,43 @@
|
||||
name: Pull Request
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.25'
|
||||
- name: Run golangci-lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: latest
|
||||
build:
|
||||
name: Build server
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.25'
|
||||
- name: Download dependencies
|
||||
run: go mod download
|
||||
- name: Build application
|
||||
run: CGO_ENABLED=0 GOOS=linux go build -o server ./cmd/web/main.go
|
||||
docker:
|
||||
name: Build Docker image
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
- name: Build Docker image
|
||||
run: docker build -t links.stevanfreeborn.com .
|
||||
|
||||
Reference in New Issue
Block a user