Skip to content

Commit 173c8af

Browse files
authored
Merge pull request #34 from anyproto/OPS-860
OPS-860 any-sync-tools
2 parents 4aecbc5 + 2733d82 commit 173c8af

File tree

2 files changed

+9
-200
lines changed

2 files changed

+9
-200
lines changed

.github/workflows/push-docker-image.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 9 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,192 +1,16 @@
1+
name: Release
2+
13
on:
24
push:
3-
# Sequence of patterns matched against refs/tags
45
tags:
5-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6-
7-
name: Build and release
6+
- 'v*.*.*'
87

98
permissions: write-all
109

1110
jobs:
12-
build:
13-
name: build release
14-
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
arch:
18-
- amd64
19-
- arm64
20-
os:
21-
- linux
22-
- windows
23-
- darwin
24-
go-version:
25-
- '1.24'
26-
include:
27-
- arch: amd64
28-
rpm_arch: x86_64
29-
- arch: arm64
30-
rpm_arch: aarch64
31-
32-
steps:
33-
- uses: actions/checkout@v3
34-
- uses: actions/setup-go@v5
35-
with:
36-
go-version: '${{ matrix.go-version }}'
37-
check-latest: true
38-
39-
# build {{
40-
- name: Install deps
41-
run: make deps CGO_ENABLED=0
42-
43-
#- name: unit tests
44-
# run: make test CGO_ENABLED=0
45-
46-
- name: Build
47-
run: make build CGO_ENABLED=0 BUILD_GOOS=${{ matrix.os}} BUILD_GOARCH=${{ matrix.arch }}
48-
# }}
49-
50-
- name: Get release version
51-
id: release-version
52-
run: |
53-
echo "$GITHUB_REF_NAME" | sed 's|^[a-zA-Z]\+|RELEASE_VERSION=|' >> $GITHUB_OUTPUT
54-
echo "$GITHUB_REF_NAME" | sed 's|^[a-zA-Z]\+|RELEASE_VERSION_RPM=|; s|-|_|g' >> $GITHUB_OUTPUT # FPM automatically converts versions for RPM
55-
56-
- name: Copy config file in ./bin
57-
run: cp ./any-sync-network/defaultTemplate.yml ./bin/
58-
59-
# create asset {{
60-
- name: Create zip | Windows
61-
if: matrix.os == 'windows'
62-
run: |
63-
zip --junk-paths ${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.zip bin/*
64-
65-
- name: Create tar | Linux and Darwin
66-
if: matrix.os != 'windows'
67-
run: |
68-
tar \
69-
--create \
70-
--gzip \
71-
--verbose \
72-
--exclude='.gitignore' \
73-
--file=${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.tgz \
74-
--directory=bin/ \
75-
.
76-
- name: Create package | Deb
77-
if: matrix.os == 'linux'
78-
uses: fb929/github-action-fpm@master
79-
with:
80-
fpm_opts:
81-
--name ${{ github.event.repository.name }}
82-
--version ${{ steps.release-version.outputs.RELEASE_VERSION }}
83-
--architecture ${{ matrix.arch }}
84-
--exclude '*/.gitignore'
85-
--exclude '*/.git'
86-
--input-type dir
87-
--output-type deb
88-
fpm_args: ./bin
89-
90-
- name: Create package | Rpm
91-
if: matrix.os == 'linux'
92-
uses: fb929/github-action-fpm@master
93-
with:
94-
fpm_opts:
95-
--name ${{ github.event.repository.name }}
96-
--version ${{ steps.release-version.outputs.RELEASE_VERSION }}
97-
--architecture ${{ matrix.rpm_arch }}
98-
--exclude '*/.gitignore'
99-
--exclude '*/.git'
100-
--input-type dir
101-
--output-type rpm
102-
fpm_args: ./bin
103-
# }}
104-
105-
- name: Debug
106-
run: |
107-
ls -al ./
108-
109-
# upload-release-asset {{
110-
- name: Create release and upload asset zip
111-
uses: softprops/action-gh-release@v2
112-
if: matrix.os == 'windows'
113-
with:
114-
name: Release ${{ github.ref_name }}
115-
generate_release_notes: true
116-
draft: false
117-
prerelease: false
118-
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
119-
token: ${{ secrets.ANYTYPE_PAT }}
120-
files: |
121-
${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.zip
122-
123-
- name: Create release and upload asset tgz
124-
uses: softprops/action-gh-release@v2
125-
if: matrix.os != 'windows'
126-
with:
127-
name: Release ${{ github.ref_name }}
128-
generate_release_notes: true
129-
draft: false
130-
prerelease: false
131-
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
132-
token: ${{ secrets.ANYTYPE_PAT }}
133-
files: |
134-
${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION }}.${{ matrix.os }}-${{ matrix.arch }}.tgz
135-
136-
- name: Create release and upload assets deb and rpm
137-
uses: softprops/action-gh-release@v2
138-
if: matrix.os == 'linux'
139-
with:
140-
name: Release ${{ github.ref_name }}
141-
generate_release_notes: true
142-
draft: false
143-
prerelease: false
144-
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
145-
token: ${{ secrets.ANYTYPE_PAT }}
146-
files: |
147-
${{ github.event.repository.name }}_${{ steps.release-version.outputs.RELEASE_VERSION }}_${{ matrix.arch }}.deb
148-
${{ github.event.repository.name }}-${{ steps.release-version.outputs.RELEASE_VERSION_RPM }}-1.${{ matrix.rpm_arch }}.rpm
149-
# }}
150-
151-
push-docker-image:
152-
runs-on: ubuntu-latest
153-
steps:
154-
- name: Set up QEMU
155-
uses: docker/setup-qemu-action@v3
156-
157-
- name: Set up Docker Buildx
158-
uses: docker/setup-buildx-action@v3
159-
160-
- name: Log in to GitHub Container Registry
161-
uses: docker/login-action@v3
162-
with:
163-
registry: ghcr.io
164-
username: ${{ github.repository_owner }}
165-
password: ${{ secrets.GITHUB_TOKEN }}
166-
167-
- name: Log in to DockerHub
168-
uses: docker/login-action@v3
169-
with:
170-
username: ${{ secrets.DOCKERHUB_USERNAME }}
171-
password: ${{ secrets.DOCKERHUB_TOKEN }}
172-
173-
- name: Get docker metadata
174-
id: meta
175-
uses: docker/metadata-action@v5
176-
with:
177-
images: |
178-
ghcr.io/${{ github.repository }}
179-
docker.io/${{ github.repository }}
180-
tags: |
181-
type=ref,event=tag
182-
flavor: |
183-
latest=auto
184-
185-
- name: Build and push image
186-
uses: docker/build-push-action@v6
187-
with:
188-
platforms: linux/amd64,linux/arm64
189-
push: true
190-
tags: ${{ steps.meta.outputs.tags }}
191-
labels: ${{ steps.meta.outputs.labels }}
192-
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Configuration tools for Any-Sync network
11+
release-reusable:
12+
uses: anyproto/shared-actions/.github/workflows/release-go-daemons-reusable.yml@OPS-860
13+
secrets: inherit # pass all secrets
14+
with:
15+
matrix-os: '["linux", "windows","darwin"]'
16+
build-cmd: cp ./any-sync-network/defaultTemplate.yml ./bin/

0 commit comments

Comments
 (0)