Skip to content

Commit 59a16d4

Browse files
committed
ci
1 parent 095249e commit 59a16d4

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: GitHub Actions Demo
2+
run-name: ${{ github.actor }} is testing out GitHub Actions
3+
# on: [push] # 每次提交就编译
4+
on:
5+
push:
6+
tags:
7+
- '*' # 只有tag擦编译
8+
jobs:
9+
Explore-GitHub-Actions:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
13+
14+
- name: Check out repository code
15+
uses: actions/checkout@v3
16+
- name: Get the tag name
17+
run: echo "TRAVIS_BRANCH=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
18+
- shell: bash
19+
run: |
20+
echo "Latest tag name: $TRAVIS_BRANCH"
21+
make build_tar_gz
22+
23+
- name: List files in the repository
24+
run: |
25+
ls ${{ github.workspace }}
26+
27+
# 创建Release
28+
- name: Create Release
29+
id: create_release
30+
uses: actions/create-release@v1
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
tag_name: ${{ github.ref }}
35+
release_name: ${{ github.ref }}
36+
draft: false
37+
prerelease: false
38+
- name: Upload Tar Gz Assets
39+
id: uploadRelease
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
for file in $(find . -name "*.tar.gz"); do
44+
echo "Uploading $file"
45+
asset_name=$(basename $file)
46+
curl \
47+
-H "Authorization: token $GITHUB_TOKEN" \
48+
-H "Content-Type: application/gzip" \
49+
--data-binary @$file \
50+
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $file)"
51+
done
52+
- run: echo "job's status is ${{ job.status }}."
53+

0 commit comments

Comments
 (0)