WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8e8cf97

Browse files
authored
Update rust.yml
1 parent 0cb9569 commit 8e8cf97

File tree

1 file changed

+110
-110
lines changed

1 file changed

+110
-110
lines changed

.github/workflows/rust.yml

Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,114 @@
1-
# permissions:
2-
# contents: write
3-
# actions: write
4-
# id-token: write # Required for keyless signing with OIDC
1+
permissions:
2+
contents: write
3+
actions: write
4+
id-token: write # Required for keyless signing with OIDC
55

6-
# name: Build and Release Rust Binary
6+
name: Build and Release Rust Binary
77

8-
# on:
9-
# push:
10-
# branches: [main]
11-
# tags:
12-
# - 'v*'
13-
# pull_request:
14-
# branches: [main]
8+
on:
9+
push:
10+
branches: [main]
11+
tags:
12+
- 'v*'
13+
pull_request:
14+
branches: [main]
1515

16-
# jobs:
17-
# build:
18-
# name: Build on ${{ matrix.os }}
19-
# strategy:
20-
# matrix:
21-
# include:
22-
# - os: ubuntu-latest
23-
# artifact_name: evaluate
24-
# archive_name: evaluate.linux.tar.gz
25-
# - os: windows-latest
26-
# artifact_name: evaluate.exe
27-
# archive_name: evaluate.windows.zip
28-
# - os: macos-latest
29-
# artifact_name: evaluate
30-
# archive_name: evaluate.macos.tar.gz
31-
# runs-on: ${{ matrix.os }}
32-
# steps:
33-
# - uses: actions/checkout@v3
34-
# - name: Install Rust
35-
# uses: actions-rs/toolchain@v1
36-
# with:
37-
# profile: minimal
38-
# toolchain: stable
39-
# override: true
40-
# - name: Build
41-
# uses: actions-rs/cargo@v1
42-
# with:
43-
# command: build
44-
# args: --release
45-
# - name: Compress Binary (Unix)
46-
# if: runner.os != 'Windows'
47-
# run: |
48-
# cd target/release
49-
# tar -czvf "${{ matrix.archive_name }}" "${{ matrix.artifact_name }}"
50-
# - name: Compress Binary (Windows)
51-
# if: runner.os == 'Windows'
52-
# run: |
53-
# Compress-Archive -Path "target/release/${{ matrix.artifact_name }}" -DestinationPath "target/release/${{ matrix.archive_name }}"
54-
# shell: pwsh
55-
# - name: Upload Build Artifact
56-
# uses: actions/upload-artifact@v4
57-
# with:
58-
# name: ${{ matrix.archive_name }}
59-
# path: target/release/${{ matrix.archive_name }}
16+
jobs:
17+
build:
18+
name: Build on ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
include:
22+
- os: ubuntu-latest
23+
artifact_name: evaluate
24+
archive_name: evaluate.linux.tar.gz
25+
- os: windows-latest
26+
artifact_name: evaluate.exe
27+
archive_name: evaluate.windows.zip
28+
- os: macos-latest
29+
artifact_name: evaluate
30+
archive_name: evaluate.macos.tar.gz
31+
runs-on: ${{ matrix.os }}
32+
steps:
33+
- uses: actions/checkout@v3
34+
- name: Install Rust
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
profile: minimal
38+
toolchain: stable
39+
override: true
40+
- name: Build
41+
uses: actions-rs/cargo@v1
42+
with:
43+
command: build
44+
args: --release
45+
- name: Compress Binary (Unix)
46+
if: runner.os != 'Windows'
47+
run: |
48+
cd target/release
49+
tar -czvf "${{ matrix.archive_name }}" "${{ matrix.artifact_name }}"
50+
- name: Compress Binary (Windows)
51+
if: runner.os == 'Windows'
52+
run: |
53+
Compress-Archive -Path "target/release/${{ matrix.artifact_name }}" -DestinationPath "target/release/${{ matrix.archive_name }}"
54+
shell: pwsh
55+
- name: Upload Build Artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: ${{ matrix.archive_name }}
59+
path: target/release/${{ matrix.archive_name }}
6060

61-
# release:
62-
# name: Create and Upload Release
63-
# needs: [build]
64-
# if: github.ref == 'refs/heads/main'
65-
# runs-on: ubuntu-latest
66-
# steps:
67-
# - uses: actions/checkout@v3
68-
# with:
69-
# fetch-depth: 0
70-
# - name: Configure Git
71-
# run: |
72-
# git config user.name github-actions
73-
# git config user.email [email protected]
74-
# - name: Generate tag
75-
# id: tag
76-
# run: |
77-
# TAG_NAME="v$(date +'%Y%m%d%H%M%S')"
78-
# echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
79-
# git tag $TAG_NAME
80-
# git push origin $TAG_NAME
81-
# - name: Download all workflow artifacts
82-
# uses: actions/download-artifact@v4
83-
# with:
84-
# path: artifacts
85-
# - name: Prepare release files
86-
# run: |
87-
# mkdir -p release_files
88-
# find artifacts -type f -exec cp {} release_files/ \;
89-
# ls -la release_files/
90-
# - name: Install Cosign
91-
# uses: sigstore/cosign-installer@main
92-
# - name: Sign artifacts (Keyless)
93-
# run: |
94-
# for file in release_files/*; do
95-
# echo "Signing file: $file"
96-
# cosign sign-blob --yes "$file" \
97-
# --output-signature "${file}.sig" \
98-
# --output-certificate "${file}.pem" \
99-
# --bundle "${file}.sig.bundle"
100-
# # Verify the files exist
101-
# ls -la "${file}.sig" "${file}.pem" "${file}.sig.bundle" || true
102-
# done
103-
# echo "Files in release_files directory after signing:"
104-
# ls -la release_files/
105-
# - name: Create Release
106-
# uses: softprops/action-gh-release@v1
107-
# with:
108-
# files: release_files/*
109-
# tag_name: ${{ steps.tag.outputs.TAG_NAME }}
110-
# name: Release ${{ steps.tag.outputs.TAG_NAME }}
111-
# draft: false
112-
# prerelease: false
113-
# env:
114-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
release:
62+
name: Create and Upload Release
63+
needs: [build]
64+
if: github.ref == 'refs/heads/main'
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v3
68+
with:
69+
fetch-depth: 0
70+
- name: Configure Git
71+
run: |
72+
git config user.name github-actions
73+
git config user.email [email protected]
74+
- name: Generate tag
75+
id: tag
76+
run: |
77+
TAG_NAME="v$(date +'%Y%m%d%H%M%S')"
78+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
79+
git tag $TAG_NAME
80+
git push origin $TAG_NAME
81+
- name: Download all workflow artifacts
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: artifacts
85+
- name: Prepare release files
86+
run: |
87+
mkdir -p release_files
88+
find artifacts -type f -exec cp {} release_files/ \;
89+
ls -la release_files/
90+
- name: Install Cosign
91+
uses: sigstore/cosign-installer@main
92+
- name: Sign artifacts (Keyless)
93+
run: |
94+
for file in release_files/*; do
95+
echo "Signing file: $file"
96+
cosign sign-blob --yes "$file" \
97+
--output-signature "${file}.sig" \
98+
--output-certificate "${file}.pem" \
99+
--bundle "${file}.sig.bundle"
100+
# Verify the files exist
101+
ls -la "${file}.sig" "${file}.pem" "${file}.sig.bundle" || true
102+
done
103+
echo "Files in release_files directory after signing:"
104+
ls -la release_files/
105+
- name: Create Release
106+
uses: softprops/action-gh-release@v1
107+
with:
108+
files: release_files/*
109+
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
110+
name: Release ${{ steps.tag.outputs.TAG_NAME }}
111+
draft: false
112+
prerelease: false
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)