Skip to content

Commit

Permalink
feat(ci): use ci/cd for binary releases // dependency management
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnwriter committed Sep 22, 2023
1 parent 2ccdd79 commit 0bfa8c3
Show file tree
Hide file tree
Showing 5 changed files with 1,762 additions and 15 deletions.
7 changes: 1 addition & 6 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
custom: ['https://ko-fi.com/pwnwriter']
github: pwnwriter




ko_fi: pwnwriter
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
# Maintain dependencies for Cargo
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
93 changes: 93 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Continuous Deployment

on:
push:
tags:
- "v*.*.*"

jobs:
publish-github:
name: Publish on GitHub
runs-on: ${{ matrix.config.OS }}
strategy:
fail-fast: false
matrix:
config:
- { OS: ubuntu-latest, TARGET: "x86_64-unknown-linux-gnu" }
- { OS: ubuntu-latest, TARGET: "x86_64-unknown-linux-musl" }
- { OS: ubuntu-latest, TARGET: "i686-unknown-linux-gnu" }
- { OS: ubuntu-latest, TARGET: "i686-unknown-linux-musl" }
- { OS: ubuntu-latest, TARGET: "armv5te-unknown-linux-gnueabi" }
- { OS: ubuntu-latest, TARGET: "armv7-unknown-linux-gnueabihf" }
- { OS: ubuntu-latest, TARGET: "aarch64-unknown-linux-gnu" }
- { OS: ubuntu-latest, TARGET: "aarch64-unknown-linux-musl" }
- { OS: macos-latest, TARGET: "x86_64-apple-darwin" }
- { OS: macos-latest, TARGET: "aarch64-apple-darwin" }
- { OS: windows-latest, TARGET: "x86_64-pc-windows-msvc" }
- { OS: windows-latest, TARGET: "i686-pc-windows-msvc" }

steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.config.TARGET }}
override: true

- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --locked --target ${{ matrix.config.TARGET }}

- name: Prepare release assets
shell: bash
run: |
mkdir release/
cp {LICENSE,README.md} release/
cp target/${{ matrix.config.TARGET }}/release/haylxon release/
mv release/ haylxon-${{ env.RELEASE_VERSION }}/
- name: Create release artifacts
shell: bash
run: |
if [ "${{ matrix.config.OS }}" = "windows-latest" ]; then
7z a -tzip "haylxon-${{ env.RELEASE_VERSION }}-${{ matrix.config.TARGET }}.zip" \
haylxon-${{ env.RELEASE_VERSION }}
else
tar -czvf haylxon-${{ env.RELEASE_VERSION }}-${{ matrix.config.TARGET }}.tar.gz \
haylxon-${{ env.RELEASE_VERSION }}/
shasum -a 512 haylxon-${{ env.RELEASE_VERSION }}-${{ matrix.config.TARGET }}.tar.gz \
> haylxon-${{ env.RELEASE_VERSION }}-${{ matrix.config.TARGET }}.tar.gz.sha512
fi
- name: Upload the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: haylxon-${{ env.RELEASE_VERSION }}-${{ matrix.config.TARGET }}.*
file_glob: true
overwrite: true
tag: ${{ github.ref }}

publish-crates-io:
name: Publish on crates.io
needs: publish-github
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --locked --token ${{ secrets.CARGO_TOKEN }}
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# will have compiled files and executables
/target
urls.txt

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
Cargo.lock

# Personal pdfs
*.pdf

# These are backup files i took, before making changes
**/*.rs.bk


Loading

0 comments on commit 0bfa8c3

Please sign in to comment.