изменил иконки #62
Workflow file for this run
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
name: Release | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
- name: Тесты | |
run: | | |
go test -v ./... -gcflags=all=-l -race | |
env: | |
GO111MODULE: on | |
- name: WinRes | |
run: | | |
go install github.com/tc-hib/go-winres | |
go-winres make .\winres\winres.json | |
- name: Get version | |
id: get_version | |
run: echo ::set-output name=version::$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') | |
- name: Build for Linux | |
run: GOOS=linux GOARCH=amd64 go build -o prometheus_1C_exporter-linux-amd64 -ldflags "-X main.version=${{ steps.get_version.outputs.version }} -X main.gitCommit=${{ github.sha }}" | |
- name: Build for Windows | |
run: GOOS=windows GOARCH=amd64 go build -o prometheus_1C_exporter-windows-amd64.exe -ldflags "-X main.version=${{ steps.get_version.outputs.version }} -X main.gitCommit=${{ github.sha }}" | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
Release ${{ github.ref }} is available. | |
draft: false | |
prerelease: false | |
# получаем коммиты для описания релиза | |
- name: Get commit messages | |
id: commit_messages | |
run: | | |
COMMITS=$(git log --pretty=format:"- %s (%h)" ${{ github.event.release.tag_name }}..HEAD) | |
echo "::set-output name=commits::$COMMITS" | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Binaries | |
path: | | |
prometheus_1C_exporter-linux-amd64 | |
prometheus_1C_exporter-windows-amd64.exe | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: Binaries | |
path: prometheus_1C_exporter-binaries | |
- name: Attach binaries to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: prometheus_1C_exporter-binaries/prometheus_1C_exporter-linux-amd64 | |
asset_name: prometheus_1C_exporter-linux-amd64 | |
asset_content_type: application/octet-stream | |
- name: Attach binaries to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: prometheus_1C_exporter-binaries/prometheus_1C_exporter-windows-amd64.exe | |
asset_name: prometheus_1C_exporter-windows-amd64.exe | |
asset_content_type: application/octet-stream | |
release_body: | | |
Release ${{ github.ref }} is available. | |
Commits: | |
${{ steps.commit_messages.outputs.commits }} |