-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows/release.yml moved on reusable workflow
- Loading branch information
Showing
1 changed file
with
5 additions
and
139 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 |
---|---|---|
|
@@ -9,142 +9,8 @@ name: release | |
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
name: build release | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
arch: | ||
- amd64 | ||
- arm64 | ||
os: | ||
- linux | ||
go-version: | ||
- '1.22' | ||
include: | ||
- arch: amd64 | ||
rpm_arch: x86_64 | ||
- arch: arm64 | ||
rpm_arch: aarch64 | ||
env: | ||
GOPRIVATE: github.com/anyproto | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '${{ matrix.go-version }}' | ||
check-latest: true | ||
- name: git config | ||
run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf https://github.com/ | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: 6.0 | ||
#mongodb-replica-set: test-rs | ||
|
||
# build {{ | ||
- name: 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_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 | ||
# create asset {{ | ||
- name: create zip archive | ||
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 archive | ||
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/[email protected] | ||
if: matrix.os == 'windows' | ||
with: | ||
name: Release ${{ github.ref_name }} | ||
generate_release_notes: true | ||
draft: false | ||
prerelease: true | ||
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow | ||
token: ${{ secrets.ANYTYPE_PAT }} | ||
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/[email protected] | ||
if: matrix.os != 'windows' | ||
with: | ||
name: Release ${{ github.ref_name }} | ||
generate_release_notes: true | ||
draft: false | ||
prerelease: true | ||
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow | ||
token: ${{ secrets.ANYTYPE_PAT }} | ||
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/[email protected] | ||
if: matrix.os == 'linux' | ||
with: | ||
name: Release ${{ github.ref_name }} | ||
generate_release_notes: true | ||
draft: false | ||
prerelease: true | ||
# for triggering workflow "push-docker-image-release" - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow | ||
token: ${{ secrets.ANYTYPE_PAT }} | ||
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 | ||
# }} | ||
release-reusable: | ||
uses: anyproto/any-sync-node/.github/workflows/release-reusable.yml@reusableReleaseWorkflow | ||
secrets: inherit # pass all secrets | ||
with: | ||
start_mongodb: true |