Skip to content

处理命名

处理命名 #12

Workflow file for this run

name: Release
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24.2'
- name: Enable Go Modules and Download Dependencies
run: |
go mod tidy
go mod download
- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
echo "$GOPATH/bin" >> $GITHUB_PATH
- name: Install Docker
run: |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
- name: Install Docker Compose
run: |
sudo wget "https://github.com/docker/compose/releases/download/v2.33.1/docker-compose-linux-x86_64" -O /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
- name: Build and Release
run: make release
- name: Upload artifacts 1
uses: actions/upload-artifact@v4
with:
name: StealthIMFileAPI
path: ./bin/StealthIMFileAPI
- name: Upload artifacts 2
uses: actions/upload-artifact@v4
with:
name: StealthIMFileAPI.exe
path: ./bin/StealthIMFileAPI.exe
- name: Upload artifacts 3
uses: actions/upload-artifact@v4
with:
name: StealthIMFileAPI.docker.zst
path: ./bin/StealthIMFileAPI.docker.zst
upload-package:
runs-on: ubuntu-latest
needs: release
steps:
- name: Download File
uses: actions/download-artifact@v4
with:
name: StealthIMFileAPI.docker.zst
- name: Unpack File
run: |
sudo apt-get update
sudo apt-get install -y zstd
zstd -d StealthIMFileAPI.docker.zst
- name: Load Docker image
run: docker load -i StealthIMFileAPI.docker
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PKGTOKEN }}
- name: Tag and push Docker image
run: |
docker tag $(docker images -q | head -n 1) ghcr.io/$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')/$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')/stealthimfileapi-app:latest
docker push ghcr.io/$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')/$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')/stealthimfileapi-app:latest