Skip to content

added new feature: --nsec #25

added new feature: --nsec

added new feature: --nsec #25

# .github/workflow/release-by-label.yml
# automatically perform release when a version tag is pushed via git
name: "tagged-release"
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
tagname:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag }}
steps:
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- id: vars
shell: bash
run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- if: env.TAG_NAME == 'nightly'
run: echo 'TAG_NAME=nightly-${{ steps.vars.outputs.sha_short }}' >> $GITHUB_ENV
- id: tag
run: echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
needs: tagname
container: ubuntu:24.04
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v3
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Install dependencies
run: |
apt-get -y update
apt-get -y install cmake pkg-config libfontconfig-dev libgtk-3-dev libssl-dev libolm-dev rename wget curl
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
profile: minimal
- name: Build
run: cargo build --profile release --bin nostr-commander-rs
- name: Gzip
run: |
mkdir nostr-commander-rs
cp ./target/release/nostr-commander-rs nostr-commander-rs/
cp README.md nostr-commander-rs/
cp LICENSE nostr-commander-rs/
cp help.help.txt nostr-commander-rs/
cp help.manual.txt nostr-commander-rs/
cp help.usage.txt nostr-commander-rs/
tar -zcvf ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz nostr-commander-rs
# tar -zcvf ./nostr-commander-rs_linux.tar.gz nostr-commander-rs
sha256sum ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz > ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz.sha256sum
echo "SHA256 checksum is: "
cat ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz.sha256sum
ls
ls -l
echo ${TAG_NAME} > tag.txt
cat tag.txt
- name: Upload artifact Linux
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
./nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
./nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
retention-days: 1
# this overwrites all files in the workspace, so files from before will be lost.
# - uses: actions/checkout@master
#
# This would compile and run test cases, but we have a separate Github action for that
# - name: Build
# run: cargo build --verbose
# - name: Run tests
# run: cargo test --verbose
- name: Compile
id: compile
uses: rust-build/rust-build.action@master
with:
RUSTTARGET: x86_64-pc-windows-gnu
UPLOAD_MODE: none
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
${{ steps.compile.outputs.BUILT_ARCHIVE }}
${{ steps.compile.outputs.BUILT_CHECKSUM }}
- name: Compile
id: compile2
uses: rust-build/rust-build.action@master
with:
RUSTTARGET: x86_64-unknown-linux-musl
# ARCHIVE_TYPES: tar.gz
UPLOAD_MODE: none
MINIFY: true
EXTRA_FILES: "README.md LICENSE help.help.txt help.manual.txt help.usage.txt"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
${{ steps.compile2.outputs.BUILT_ARCHIVE }}
${{ steps.compile2.outputs.BUILT_CHECKSUM }}
# error: linking with `/opt/osxcross/target/bin/x86_64-apple-darwin14-clang` failed: exit status: 1
# = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.76.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin:/opt/osxcross/target/bin:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" ZERO_AR_DATE="1" "/opt/osxcross/target/bin/x86_64-apple-darwin14-clang" "-arch" "x86_64" "-m64" "/tmp/rustcMaqGbI/symbols.o" "/github/workspace/./target/x86_64-apple-darwin/release/deps/nostr_commander_rs-d8f4107325f6cff0.nostr_commander_rs.d13df3b232ebb334-cgu.00.rcgu.o" "-L" "/github/workspace/./target/x86_64-apple-darwin/release/deps" "-L" "/github/workspace/./target/release/deps" "-L" "/github/workspace/./target/x86_64-apple-darwin/release/build/ring-d6c03c4e1567ca2d/out" "-L" "/github/workspace/./target/x86_64-apple-darwin/release/build/secp256k1-sys-1f00d2d20ca4260f/out" "-L" "/usr/local/rustup/toolchains/1.76.0-x86_64-unknown-linux-musl/lib/rustlib/x
# = note: ld: warning: object file (/tmp/rustcMaqGbI/symbols.o) was built for newer macOS version (10.12) than being linked (10.8)
# ld: warning: object file (/github/workspace/./target/x86_64-apple-darwin/release/deps/nostr_commander_rs-d8f4107325f6cff0.nostr_commander_rs.d13df3b232ebb334-cgu.00.rcgu.o) was built for newer macOS version (10.12) than being linked (10.8)
# In Sept 2024 linking failed
# - name: Compile
# id: compile3
# uses: rust-build/rust-build.action@master
# with:
# RUSTTARGET: x86_64-apple-darwin
# # ARCHIVE_TYPES: tar.gz
# UPLOAD_MODE: none
# MINIFY: true
# EXTRA_FILES: "README.md LICENSE help.help.txt help.manual.txt help.usage.txt"
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: Binary
# path: |
# ${{ steps.compile3.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile3.outputs.BUILT_CHECKSUM }}
- name: Final-check
run: |
ls -l
echo "content of output directory"
ls -l output
TAG_NAME=$(cat tag.txt)
cat tag.txt
echo "tag name: $TAG_NAME"
echo "release tag: $RELEASE_TAG_NAME"
echo "env release tag: " ${{ env.RELEASE_TAG_NAME }}
echo "if rename not installed, will stop action if using rename"
echo $(which rename)
echo $(rename -h)
echo $(rename -v)
echo $(rename -V)
rename 's/_null_/_${{ env.RELEASE_TAG_NAME }}_/' output/*
#cd output
#ls
#mv nostr-commander-rs_null_x86_64-pc-windows-gnu.zip nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip
#mv nostr-commander-rs_null_x86_64-pc-windows-gnu.zip.sha256sum nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip.sha256sum
#mv nostr-commander-rs_null_x86_64-unknown-linux-musl.zip nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip
#mv nostr-commander-rs_null_x86_64-unknown-linux-musl.zip.sha256sum nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip.sha256sum
#mv nostr-commander-rs_null_x86_64-apple-darwin.zip nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip
#mv nostr-commander-rs_null_x86_64-apple-darwin.zip.sha256sum nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip.sha256sum
#cd ..
ls * output/*
# https://github.com/softprops/action-gh-release
# do wildcards like * work in files?
- name: Release
uses: "softprops/action-gh-release@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
generate_release_notes: true
files: |
README.md
LICENSE
nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip.sha256sum
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip.sha256sum
# output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip
# output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip.sha256sum
hel*.txt
# ${{ steps.compile.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile.outputs.BUILT_CHECKSUM }}
# ${{ steps.compile2.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile2.outputs.BUILT_CHECKSUM }}
# ${{ steps.compile3.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile3.outputs.BUILT_CHECKSUM }}