Release v1.0.28
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Release Build
|
||||
name: Build Builder Docker Image
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
@@ -21,31 +21,35 @@ jobs:
|
||||
echo "github.sha = ${{ github.sha }}"
|
||||
echo "github.repository = ${{ github.repository }}"
|
||||
echo "========================"
|
||||
echo "Cloning..."
|
||||
git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
||||
cd hello_gitea
|
||||
echo "Checkout to ${{ github.ref }} ..."
|
||||
git checkout ${{ github.ref }}
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
run: |
|
||||
# Docker is already installed in docker:dind image
|
||||
echo "look at docker version"
|
||||
docker --version
|
||||
# Setup Docker Buildx for multi-platform builds
|
||||
echo "setup buildx"
|
||||
docker buildx create --use
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: Login to Docker Hub
|
||||
run: |
|
||||
echo "login to docker hub ..."
|
||||
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build multi-platform Docker images
|
||||
run: |
|
||||
cd hello_gitea
|
||||
# Build multi-platform images using buildx
|
||||
echo "Build multi-platform images using buildx ..."
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:${{ github.ref_name }} \
|
||||
--tag ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest \
|
||||
--push \
|
||||
-f Dockerfile.builder \
|
||||
.
|
||||
|
||||
.
|
@@ -5,130 +5,130 @@ on:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
# create-release:
|
||||
# runs-on: ubuntu-latest
|
||||
# container:
|
||||
# # image: golang:1.21
|
||||
# image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
|
||||
# needs: create-release-branch
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# run: |
|
||||
# git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
||||
# cd hello_gitea
|
||||
# git checkout ${{ github.ref }}
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# image: golang:1.21
|
||||
image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
|
||||
needs: create-release-branch
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
run: |
|
||||
git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
||||
cd hello_gitea
|
||||
git checkout ${{ github.ref }}
|
||||
|
||||
# - name: Setup Go
|
||||
# run: |
|
||||
# # Install jq for JSON parsing
|
||||
# apt-get update && apt-get install -y jq
|
||||
# git --version
|
||||
# go version
|
||||
# jq --version
|
||||
- name: Setup Go
|
||||
run: |
|
||||
# Install jq for JSON parsing
|
||||
apt-get update && apt-get install -y jq
|
||||
git --version
|
||||
go version
|
||||
jq --version
|
||||
|
||||
# - name: Build all binaries
|
||||
# run: |
|
||||
# cd hello_gitea
|
||||
# mkdir -p bin
|
||||
- name: Build all binaries
|
||||
run: |
|
||||
cd hello_gitea
|
||||
mkdir -p bin
|
||||
|
||||
# # Build for all platforms
|
||||
# GOOS=linux GOARCH=amd64 go build -o bin/hello-api-linux-amd64 main.go
|
||||
# GOOS=linux GOARCH=arm64 go build -o bin/hello-api-linux-arm64 main.go
|
||||
# GOOS=windows GOARCH=amd64 go build -o bin/hello-api-windows-amd64.exe main.go
|
||||
# GOOS=darwin GOARCH=amd64 go build -o bin/hello-api-darwin-amd64 main.go
|
||||
# GOOS=darwin GOARCH=arm64 go build -o bin/hello-api-darwin-arm64 main.go
|
||||
# Build for all platforms
|
||||
GOOS=linux GOARCH=amd64 go build -o bin/hello-api-linux-amd64 main.go
|
||||
GOOS=linux GOARCH=arm64 go build -o bin/hello-api-linux-arm64 main.go
|
||||
GOOS=windows GOARCH=amd64 go build -o bin/hello-api-windows-amd64.exe main.go
|
||||
GOOS=darwin GOARCH=amd64 go build -o bin/hello-api-darwin-amd64 main.go
|
||||
GOOS=darwin GOARCH=arm64 go build -o bin/hello-api-darwin-arm64 main.go
|
||||
|
||||
# # Create archives
|
||||
# cd bin
|
||||
# tar -czf hello-api-linux-amd64.tar.gz hello-api-linux-amd64
|
||||
# tar -czf hello-api-linux-arm64.tar.gz hello-api-linux-arm64
|
||||
# tar -czf hello-api-windows-amd64.tar.gz hello-api-windows-amd64.exe
|
||||
# tar -czf hello-api-darwin-amd64.tar.gz hello-api-darwin-amd64
|
||||
# tar -czf hello-api-darwin-arm64.tar.gz hello-api-darwin-arm64
|
||||
# Create archives
|
||||
cd bin
|
||||
tar -czf hello-api-linux-amd64.tar.gz hello-api-linux-amd64
|
||||
tar -czf hello-api-linux-arm64.tar.gz hello-api-linux-arm64
|
||||
tar -czf hello-api-windows-amd64.tar.gz hello-api-windows-amd64.exe
|
||||
tar -czf hello-api-darwin-amd64.tar.gz hello-api-darwin-amd64
|
||||
tar -czf hello-api-darwin-arm64.tar.gz hello-api-darwin-arm64
|
||||
|
||||
# ls -la
|
||||
ls -la
|
||||
|
||||
# - name: Create Release
|
||||
# run: |
|
||||
# cd hello_gitea
|
||||
# # Create release using Gitea API
|
||||
# curl -X POST \
|
||||
# -H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
# -H "Content-Type: application/json" \
|
||||
# -d '{
|
||||
# "tag_name": "${{ github.ref_name }}",
|
||||
# "name": "Release ${{ github.ref_name }}",
|
||||
# "body": "Automated release with multi-platform binaries and Docker image",
|
||||
# "draft": false,
|
||||
# "prerelease": false
|
||||
# }' \
|
||||
# "https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases"
|
||||
- name: Create Release
|
||||
run: |
|
||||
cd hello_gitea
|
||||
# Create release using Gitea API
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"tag_name": "${{ github.ref_name }}",
|
||||
"name": "Release ${{ github.ref_name }}",
|
||||
"body": "Automated release with multi-platform binaries and Docker image",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}' \
|
||||
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases"
|
||||
|
||||
# # Upload assets
|
||||
# RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
# "https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/tags/${{ github.ref_name }}" | \
|
||||
# jq -r '.id')
|
||||
# Upload assets
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/tags/${{ github.ref_name }}" | \
|
||||
jq -r '.id')
|
||||
|
||||
# # Upload all binaries
|
||||
# for file in bin/*.tar.gz; do
|
||||
# echo "Uploading $file..."
|
||||
# curl -X POST \
|
||||
# -H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
# -H "Content-Type: application/octet-stream" \
|
||||
# --data-binary @$file \
|
||||
# "https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/$RELEASE_ID/assets?name=$(basename $file)"
|
||||
# done
|
||||
# Upload all binaries
|
||||
for file in bin/*.tar.gz; do
|
||||
echo "Uploading $file..."
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @$file \
|
||||
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/$RELEASE_ID/assets?name=$(basename $file)"
|
||||
done
|
||||
|
||||
# create-docker-image:
|
||||
# runs-on: ubuntu-latest
|
||||
# container:
|
||||
# image: docker:28.3.2-dind
|
||||
# needs: create-release
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# run: |
|
||||
# # Install git
|
||||
# apk add --no-cache git
|
||||
|
||||
# echo "=== GitHub Variables ==="
|
||||
# echo "github.ref = ${{ github.ref }}"
|
||||
# echo "github.ref_name = ${{ github.ref_name }}"
|
||||
# echo "github.sha = ${{ github.sha }}"
|
||||
# echo "github.repository = ${{ github.repository }}"
|
||||
# echo "========================"
|
||||
# git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
||||
# cd hello_gitea
|
||||
# git checkout ${{ github.ref }}
|
||||
|
||||
# - name: Setup Docker Buildx
|
||||
# run: |
|
||||
# # Docker is already installed in docker:dind image
|
||||
# docker --version
|
||||
|
||||
# # Setup Docker Buildx for multi-platform builds
|
||||
# docker buildx create --use
|
||||
# docker buildx inspect --bootstrap
|
||||
|
||||
# - name: Login to Docker Hub
|
||||
# run: |
|
||||
# echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
|
||||
# - name: Build multi-platform Docker images
|
||||
# run: |
|
||||
# cd hello_gitea
|
||||
# # Build multi-platform images using buildx
|
||||
# docker buildx build \
|
||||
# --platform linux/amd64,linux/arm64 \
|
||||
# --tag ${{ secrets.DOCKERHUB_USERNAME }}/hello-api:${{ github.ref_name }} \
|
||||
# --tag ${{ secrets.DOCKERHUB_USERNAME }}/hello-api:latest \
|
||||
# --push \
|
||||
# .
|
||||
|
||||
create-release-branch:
|
||||
create-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker:28.3.2-dind
|
||||
# needs: create-docker-image
|
||||
needs: create-release
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
run: |
|
||||
# Install git
|
||||
apk add --no-cache git
|
||||
|
||||
echo "=== GitHub Variables ==="
|
||||
echo "github.ref = ${{ github.ref }}"
|
||||
echo "github.ref_name = ${{ github.ref_name }}"
|
||||
echo "github.sha = ${{ github.sha }}"
|
||||
echo "github.repository = ${{ github.repository }}"
|
||||
echo "========================"
|
||||
git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
||||
cd hello_gitea
|
||||
git checkout ${{ github.ref }}
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
run: |
|
||||
# Docker is already installed in docker:dind image
|
||||
docker --version
|
||||
|
||||
# Setup Docker Buildx for multi-platform builds
|
||||
docker buildx create --use
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: Login to Docker Hub
|
||||
run: |
|
||||
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build multi-platform Docker images
|
||||
run: |
|
||||
cd hello_gitea
|
||||
# Build multi-platform images using buildx
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ secrets.DOCKERHUB_USERNAME }}/hello-api:${{ github.ref_name }} \
|
||||
--tag ${{ secrets.DOCKERHUB_USERNAME }}/hello-api:latest \
|
||||
--push \
|
||||
.
|
||||
|
||||
update-to-release-branch:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker:28.3.2-dind
|
||||
needs: create-docker-image
|
||||
steps:
|
||||
- name: Create Release Branch
|
||||
run: |
|
||||
@@ -137,6 +137,9 @@ jobs:
|
||||
echo "github.ref_name = ${{ github.ref_name }}"
|
||||
echo "github.sha = ${{ github.sha }}"
|
||||
echo "github.repository = ${{ github.repository }}"
|
||||
echo "DOCKERHUB_USERNAME = ${{ secrets.DOCKERHUB_USERNAME }}"
|
||||
echo "DOCKERHUB_TOKEN = ${{ secrets.DOCKERHUB_TOKEN }}"
|
||||
echo "GITEATOKEN = ${{ secrets.GITEATOKEN }}"
|
||||
echo "========================"
|
||||
# Clone repository
|
||||
echo "Cloning repository..."
|
||||
|
Reference in New Issue
Block a user