Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
c8e8b45099 | |||
5614bd6ada | |||
8c7ffdf5a7 | |||
78f53564b1 | |||
4e84f9fdc9 |
@@ -6,33 +6,44 @@ on:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: [your-runner-name]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- 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: Build
|
||||
run: |
|
||||
cd hello_gitea
|
||||
mkdir -p bin
|
||||
go build -o bin/hello-api-${{ github.ref_name }} main.go
|
||||
ls -la bin/
|
||||
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEATOKEN }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: "Release ${{ github.ref }}"
|
||||
body: "Automated release"
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEATOKEN }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./bin/hello-api-${{ github.ref_name }}
|
||||
asset_name: hello-api-${{ github.ref_name }}
|
||||
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",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}' \
|
||||
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases"
|
||||
|
||||
# Upload asset
|
||||
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')
|
||||
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @bin/hello-api-${{ github.ref_name }} \
|
||||
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/$RELEASE_ID/assets?name=hello-api-${{ github.ref_name }}"
|
Reference in New Issue
Block a user