template/gnostr-syndicate #1
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: gnostr | |
on: | |
schedule: | |
- cron: '*/10 * * * *' | |
pull_request: | |
branches: | |
- '*' | |
- '*/*' | |
- '**' | |
- 'master' | |
- 'main' | |
push: | |
tags: | |
- '**[0-9]+.[0-9]+.[0-9]+*' | |
branches: | |
- '*' | |
- '*/*' | |
- '**' | |
- 'master' | |
- 'main' | |
workflow_dispatch: | |
env: | |
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
prefix: ["", "1.79.0-"] | |
os: ["alpine"] | |
tag: ["3.19", "3.20"] | |
curl: ["0.0.45", "0.0.43"] | |
container: rust:${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }} | |
steps: | |
- name: Restore rustup | |
id: cache-rustup-restore | |
uses: actions/cache/restore@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
~/.rustup | |
key: ${{ runner.os }}-rustup | |
- name: Restore cargo | |
id: cache-cargo-restore | |
uses: actions/cache/restore@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
~/.cargo | |
key: ${{ runner.os }}-cargo | |
- name: Restore target | |
id: cache-target-restore | |
uses: actions/cache/restore@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-target | |
## notice: this is a pre checkout step | |
## notice: additional operations can be done prior to checkout | |
- run: apk update && apk add bash cmake curl git libcrypto3 make musl-dev perl-utils pipx python3 && pipx install virtualenv | |
- run: printenv | |
- run: git config --global --add safe.directory /__w/gnostr/gnostr | |
- run: touch ~/GITHUB_TOKEN.txt | |
- name: checkout@v3 fetch-depth submodules set-safe-dir true | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '1' | |
submodules: 'true' | |
set-safe-directory: 'true' | |
## notice: these are post checkout steps | |
- run: apk update && apk add autoconf automake build-base cargo openssl-dev libtool linux-headers make sudo | |
- run: make detect || true | |
- run: rm -rf CMakeCache.txt CMakeFiles Makefile || echo | |
- run: make help | |
- run: git config --global --add safe.directory /__w/gnostr/gnostr | |
- run: make libsecp256k1.a || rm -rf deps/secp256k1 && make libsecp256k1.a | |
- run: make gnostr gnostr-am && cp gnostr gnostr-alpine | |
- run: make gnostr-install | |
- run: ls | |
- run: cmake . | |
- run: make all | |
if: github.event_name == 'pull_request' | |
- run: make gnostr-install | |
## TODO: add ssh config to act sequence | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/gnostr-bins-installer.sh | sh | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/gnostrd-installer.sh | sh | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/gnostr-cli-installer.sh | sh | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/gnostr-gui-installer.sh | sh | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/gnostr-lookup-installer.sh | sh | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/gnostr-tui-installer.sh | sh | |
- run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/gnostr-org/gnostr/releases/download/${{matrix.curl}}/nips-installer.sh | sh | |
- name: Save rustup | |
id: cache-rustup-save | |
uses: actions/cache/save@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
~/.rustup | |
key: ${{ steps.cache-rustup-restore.outputs.cache-primary-key }} | |
- name: Save cargo | |
id: cache-cargo-save | |
uses: actions/cache/save@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
~/.cargo | |
key: ${{ steps.cache-cargo-restore.outputs.cache-primary-key }} | |
- name: Save target | |
id: cache-target-save | |
uses: actions/cache/save@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
target | |
key: ${{ steps.cache-target-restore.outputs.cache-primary-key }} | |
- name: "Build release" | |
run: | | |
printenv | |
ls -a | |
cp gnostr gnostr-${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }}-${{matrix.curl}} | |
shasum -a 256 gnostr-${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }}-${{matrix.curl}} > \ | |
gnostr-${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }}-${{matrix.curl}}.txt | |
- run: gnostr-nip --sec $(gnostr-sha256) | gnostr-post-event | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && matrix.os == 'alpine' | |
- run: gnostr-syndicate | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && matrix.os == 'alpine' | |
- name: Save state | |
run: echo "{name}={value}" >> $GITHUB_STATE | |
- name: Set output | |
run: echo "{name}={value}" >> $GITHUB_OUTPUT | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
if: ${{ !env.ACT }} && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && matrix.os == 'ubuntu-matrix' | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }}-${{matrix.curl}} | |
prerelease: false | |
title: "Release Build" | |
files: | | |
gnostr | |
gnostr-${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }}-${{matrix.curl}} | |
gnostr-${{ matrix.prefix }}${{ matrix.os }}${{ matrix.tag }}-${{matrix.curl}}.txt |