Skip to content

Commit

Permalink
💚 Fix CI Build
Browse files Browse the repository at this point in the history
  • Loading branch information
luoshuijs committed Mar 20, 2024
1 parent 1c9ee28 commit 459d0b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 118 deletions.
128 changes: 11 additions & 117 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ jobs:
runs-on: ubuntu-latest
environment: Linux
steps:
- uses: actions/checkout@v3
with:
repository: 'gngpp/ninjaer'
token: ${{ secrets.CR_PAT }}
- uses: actions/checkout@v4

- name: Install depends
run: |
Expand All @@ -40,136 +37,34 @@ jobs:
echo "tag=latest" >> $GITHUB_ENV
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: gngpp
password: ${{ secrets.CR_PAT }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build package
shell: bash
env:
GIT_TOKEN: ${{ secrets.CR_PAT }}
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rmi=true os=linux bash +x build.sh
- name: Upload binaries to GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.CR_PAT }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
uploads/*
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: true

windows:
name: Windows
runs-on: ubuntu-latest
environment: Windows
steps:
- uses: actions/checkout@v3
with:
repository: 'gngpp/ninjaer'
token: ${{ secrets.CR_PAT }}

- name: Install depends
run: |
sudo apt update && sudo apt install upx rename -y
- name: Get tag
if: startsWith(github.ref, 'refs/tags/')
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true

- name: Tag Check
run: |
echo "tag=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV
echo "tag=${{ steps.tag.outputs.tag }}" >> $GITHUB_OUTPUT
if [ -z "${{ steps.tag.outputs.tag }}" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT
echo "tag=latest" >> $GITHUB_ENV
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gngpp
password: ${{ secrets.CR_PAT }}

- name: Build package
shell: bash
env:
GIT_TOKEN: ${{ secrets.CR_PAT }}
run: |
rmi=true os=windows bash +x build.sh
- name: Upload binaries to GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.CR_PAT }}
files: |
uploads/*
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: true

macos:
runs-on: macos-latest
name: MacOS
environment: MacOS
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: 'gngpp/ninjaer'
token: ${{ secrets.CR_PAT }}

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Get tag
if: startsWith(github.ref, 'refs/tags/')
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true

- name: Tag Check
run: |
echo "tag=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV
echo "tag=${{ steps.tag.outputs.tag }}" >> $GITHUB_OUTPUT
if [ -z "${{ steps.tag.outputs.tag }}" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT
echo "tag=latest" >> $GITHUB_ENV
fi
- name: Build
env:
GIT_TOKEN: ${{ secrets.CR_PAT }}
shell: bash
run: |
os=macos bash +x build.sh
- name: Upload binaries to GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.CR_PAT }}
files: |
uploads/*
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: true

docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [ linux ]
environment: Docker
steps:
- uses: actions/checkout@v3
with:
repository: 'gngpp/ninjaer'
token: ${{ secrets.CR_PAT }}
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -196,8 +91,8 @@ jobs:
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gngpp
password: ${{ secrets.CR_PAT }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -209,6 +104,5 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASS }}
repository: gngpp/ninja
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ build_linux_target() {
-v $HOME/.cargo/git:/root/.cargo/git \
-e "FEATURES=$features" \
-e "TARGET=$1" \
$docker_image /bin/bash -c "cargo build --release --target \$TARGET \$FEATURES"
$docker_image /bin/bash -c "apt-get update && apt-get install -y libc6-dev && cargo build --release --target \$TARGET \$FEATURES"

sudo chmod -R 777 target
if [ "$1" != "i686-unknown-linux-gnu" ] && [ "$1" != "i586-unknown-linux-gnu" ]; then
Expand Down

0 comments on commit 459d0b6

Please sign in to comment.