-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/JesuisTong/athene_network_bot
- Loading branch information
Showing
7 changed files
with
306 additions
and
61 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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
name: "publish" | ||
|
||
on: | ||
push: | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
branches: | ||
- 'main' | ||
- 'releases/**' | ||
paths: | ||
- '**.rs' | ||
|
||
jobs: | ||
create-release: | ||
|
@@ -26,15 +30,15 @@ jobs: | |
|
||
- name: create release | ||
id: create-release | ||
uses: actions/github-script@v6 | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const { data } = await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: `athene_network_bot_v${{steps.read_toml.outputs.value}}`, | ||
name: `Athene Bot v${{steps.read_toml.outputs.value}}`, | ||
body: 'Take a look at the assets to download and install this app.', | ||
body: `${{ github.event.head_commit.message }}`, | ||
draft: true, | ||
prerelease: false | ||
}) | ||
|
@@ -49,42 +53,49 @@ jobs: | |
build: [linux, macos, windows] | ||
include: | ||
- build: linux | ||
os: ubuntu-18.04 | ||
os: ubuntu-22.04 | ||
rust: nightly | ||
target: x86_64-unknown-linux-musl | ||
target: x86_64-unknown-linux-gnu | ||
archive-name: athene-bot-linux.tar.gz | ||
- build: macos | ||
os: macos-latest | ||
rust: nightly | ||
target: x86_64-apple-darwin | ||
archive-name: athene-bot-macos.tar.gz | ||
- build: windows | ||
os: windows-2019 | ||
os: windows-latest | ||
rust: nightly-x86_64-msvc | ||
target: x86_64-pc-windows-msvc | ||
archive-name: athene-bot-windows.7z | ||
fail-fast: false | ||
runs-on: ${{ matrix.platform }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: get version | ||
- name: get name | ||
uses: SebRollen/[email protected] | ||
id: read_toml | ||
with: | ||
file: "Cargo.toml" | ||
field: "package.name" | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
uses: actions-rs/toolchain@v1.0.6 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
target: ${{ matrix.target }} | ||
|
||
- name: Install libssl-dev | ||
shell: bash | ||
run: | | ||
if [ "${{ matrix.build }}" = "linux" ]; then | ||
sudo apt-get install -y pkg-config libssl-dev | ||
fi | ||
- name: Build binary | ||
run: cargo build --verbose --release --target ${{ matrix.target }} | ||
env: | ||
|
@@ -103,11 +114,27 @@ jobs: | |
cp "../target/${{ matrix.target }}/release/${{steps.read_toml.outputs.value}}" ./ | ||
tar -czf "${{ matrix.archive-name }}" LICENSE README.md ${{steps.read_toml.outputs.value}} | ||
fi | ||
- name: Upload archive | ||
uses: actions/upload-artifact@v1 | ||
ls -a | ||
- name: upload release asset | ||
uses: actions/github-script@v7 | ||
env: | ||
release_id: ${{ needs.create-release.outputs.release_id }} | ||
with: | ||
name: ${{ matrix.archive-name }} | ||
path: archive/${{ matrix.archive-name }} | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const fs = require('node:fs') | ||
github.rest.repos.uploadReleaseAsset({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: process.env.release_id, | ||
name: '${{ matrix.archive-name }}', | ||
data: await fs.readFileSync('./archive/${{ matrix.archive-name }}'), | ||
}) | ||
# - name: Upload archive | ||
# uses: actions/upload-artifact@v1 | ||
# with: | ||
# name: ${{ matrix.archive-name }} | ||
# path: archive/${{ matrix.archive-name }} | ||
|
||
publish-release: | ||
permissions: | ||
|
@@ -118,7 +145,7 @@ jobs: | |
steps: | ||
- name: publish release | ||
id: publish-release | ||
uses: actions/github-script@v6 | ||
uses: actions/github-script@v7 | ||
env: | ||
release_id: ${{ needs.create-release.outputs.release_id }} | ||
with: | ||
|
Oops, something went wrong.