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