forked from jb55/nostril
-
-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (143 loc) · 5.91 KB
/
gnostr-bot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
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