Skip to content

Merge pull request #27 from anyproto/added-conf-in-release #21

Merge pull request #27 from anyproto/added-conf-in-release

Merge pull request #27 from anyproto/added-conf-in-release #21

Workflow file for this run

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Build and release
permissions: write-all
jobs:
build:
name: Build release
runs-on: ubuntu-22.04
strategy:
matrix:
arch:
- amd64
- arm64
os:
- linux
- windows
- darwin
go-version:
- '1.23'
include:
- arch: amd64
rpm_arch: x86_64
- arch: arm64
rpm_arch: aarch64
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version: '${{ matrix.go-version }}'
check-latest: true
# build {{
- name: Install deps
run: make deps CGO_ENABLED=0
#- name: unit tests
# run: make test CGO_ENABLED=0
- name: Build
run: make build CGO_ENABLED=0 BUILD_GOOS=${{ matrix.os}} BUILD_GOARCH=${{ matrix.arch }}
# }}
- name: Get release version
id: release-version
run: |
echo "$GITHUB_REF_NAME" | sed 's|^[a-zA-Z]\+|RELEASE_VERSION=|' >> $GITHUB_OUTPUT
echo "$GITHUB_REF_NAME" | sed 's|^[a-zA-Z]\+|RELEASE_VERSION_RPM=|; s|-|_|g' >> $GITHUB_OUTPUT # FPM automatically converts versions for RPM
- name: Copy config file in ./bin
run: cp ./any-sync-network/defaultTemplate.yml ./bin/
# create asset {{
- name: Create zip | Windows
if: matrix.os == 'windows'
run: |
zip --junk-paths ${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.zip bin/*
- name: Create tar | Linux and Darwin
if: matrix.os != 'windows'
run: |
tar \
--create \
--gzip \
--verbose \
--exclude='.gitignore' \
--file=${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.tgz \
--directory=bin/ \
.
- name: Create package | Deb
if: matrix.os == 'linux'
uses: fb929/github-action-fpm@master
with:
fpm_opts:
--name ${{ github.event.repository.name }}
--version ${{ steps.release-version.outputs.RELEASE_VERSION }}
--architecture ${{ matrix.arch }}
--exclude '*/.gitignore'
--exclude '*/.git'
--input-type dir
--output-type deb
fpm_args: ./bin
- name: Create package | Rpm
if: matrix.os == 'linux'
uses: fb929/github-action-fpm@master
with:
fpm_opts:
--name ${{ github.event.repository.name }}
--version ${{ steps.release-version.outputs.RELEASE_VERSION }}
--architecture ${{ matrix.rpm_arch }}
--exclude '*/.gitignore'
--exclude '*/.git'
--input-type dir
--output-type rpm
fpm_args: ./bin
# }}
- name: Debug
run: |
ls -al ./
# upload-release-asset {{
- name: Create release and upload asset zip
uses: softprops/action-gh-release@v2
if: matrix.os == 'windows'
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
draft: false
prerelease: false
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
files: |
${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.zip
- name: Create release and upload asset tgz
uses: softprops/action-gh-release@v2
if: matrix.os != 'windows'
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
draft: false
prerelease: false
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
files: |
${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.tgz
- name: Create release and upload assets deb and rpm
uses: softprops/action-gh-release@v2
if: matrix.os == 'linux'
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
draft: false
prerelease: false
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
files: |
${{ github.event.repository.name }}_${{ steps.release-version.outputs.RELEASE_VERSION }}_${{ matrix.arch }}.deb
${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION_RPM }}-1.${{ matrix.rpm_arch }}.rpm
# }}