-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: Build proxmox-service-discovery | ||
name: Build, Tag, and Release proxmox-service-discovery | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Сборка запускается только при пуше в ветку main | ||
- main # Сборка и релиз запускаются только при пуше в ветку main | ||
|
||
jobs: | ||
build: | ||
|
@@ -18,7 +18,7 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Set up Go 1.31 | ||
# Step 2: Set up Go 1.23 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
|
@@ -47,9 +47,62 @@ jobs: | |
- name: Build proxmox-service-discovery | ||
run: go build -v -o proxmox-service-discovery-${{ matrix.goarch }} ./... | ||
|
||
# Step 7: Upload the build as an artifact | ||
# Step 7: Upload the build as an artifact for each architecture | ||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: proxmox-service-discovery-${{ matrix.goarch }} | ||
path: ./proxmox-service-discovery-${{ matrix.goarch }} | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Checkout the code | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Bump version using mathieudutour/github-tag-action | ||
- name: Bump version and create tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_prefix: "v" | ||
release_branches: "main" | ||
default_bump: "patch" # Определяет, какое обновление версии по умолчанию: major, minor или patch | ||
create_annotated_tag: true | ||
|
||
# Step 3: Create GitHub release | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
release_name: "Release ${{ steps.tag_version.outputs.new_tag }}" | ||
draft: false | ||
prerelease: false | ||
|
||
# Step 4: Upload Linux AMD64 artifact | ||
- name: Upload Linux AMD64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./proxmox-service-discovery-amd64 | ||
asset_name: proxmox-service-discovery-amd64 | ||
asset_content_type: application/octet-stream | ||
|
||
# Step 5: Upload Linux ARM64 artifact | ||
- name: Upload Linux ARM64 artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./proxmox-service-discovery-arm64 | ||
asset_name: proxmox-service-discovery-arm64 | ||
asset_content_type: application/octet-stream |