Skip to content

Commit d7c7909

Browse files
committed
chore: github ci
1 parent f3fbcf7 commit d7c7909

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

.github/workflows/ci.yml renamed to .github/workflows/release.yml

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [16.x]
17+
node-version: [18.x]
1818
steps:
1919
- name: Checkout
2020
uses: actions/checkout@v3
@@ -34,34 +34,31 @@ jobs:
3434
runs-on: ubuntu-latest
3535
strategy:
3636
matrix:
37-
node-version: [16.x]
37+
node-version: [18.x]
3838
steps:
3939
- name: Checkout
4040
uses: actions/checkout@v3
4141
with:
4242
fetch-depth: 0
43-
- name: Get the version
44-
id: get_version
43+
- name: Set variables
44+
id: set_veriables
4545
run: |
4646
# Get the version from package.json
47-
echo ::set-output name=PACKAGE_VERSION_NAME::$(node -p "require('./package.json').version")
47+
echo "PACKAGE_VERSION_NAME=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
4848
# Get the name from package.json
49-
echo ::set-output name=PACKAGE_NAME::$(node -p "require('./package.json').name")
49+
echo "PACKAGE_NAME=$(node -p "require('./package.json').name")" >> $GITHUB_ENV
5050
# current push sha
51-
echo ::set-output name=COMMIT_ID::$(echo ${{ github.sha }} | cut -c1-7)
51+
echo "COMMIT_ID=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
5252
# current push tag
53-
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
53+
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
5454
# latest tag
55-
echo ::set-output name=TAG_NAME::$(git describe --tags --abbrev=0)
55+
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
5656
# set current timestamp
57-
echo ::set-output name=TIMESTAMP::$(date +%s)
57+
echo "TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
5858
# set current time and format
59-
echo ::set-output name=BUILD_TIME::$(date "+%Y-%m-%d-%H-%M")
60-
- name: Set name
61-
id: set_name
62-
run: |
63-
echo ::set-output name=APK_NAME::$(echo "${{ steps.get_version.outputs.PACKAGE_NAME}}-${{ steps.get_version.outputs.PACKAGE_VERSION_NAME }}-${{steps.get_version.outputs.TIMESTAMP}}-${{ steps.get_version.outputs.COMMIT_ID }}.apk")
64-
echo ::set-output name=SOURCE_ZIP_NAME::$(echo "${{ env.DIST_ARCHIVE_PREFIX_NAME }}-${{ steps.get_version.outputs.PACKAGE_VERSION_NAME }}-${{steps.get_version.outputs.TIMESTAMP}}-${{ steps.get_version.outputs.COMMIT_ID }}.zip")
59+
echo "BUILD_TIME=$(date "+%Y-%m-%d-%H-%M")" >> $GITHUB_ENV
60+
# set apk name
61+
echo "APK_NAME=${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION_NAME }}-${{ env.TIMESTAMP }}-${{ env.COMMIT_ID }}.apk" >> $GITHUB_ENV
6562
- name: Build changelog
6663
id: build_changelog
6764
uses: mikepenz/[email protected]
@@ -70,14 +67,7 @@ jobs:
7067
with:
7168
configuration: '.github/config/changelog_configuration.json'
7269
ignorePreReleases: 'false'
73-
- name: Archive source code
74-
uses: papeloto/action-zip@v1
75-
with:
76-
files: |
77-
./
78-
recursive: false
79-
dest: ${{ steps.set_name.outputs.SOURCE_ZIP_NAME }}
80-
- name: Use Node.js
70+
- name: Use node
8171
uses: actions/setup-node@v3
8272
with:
8373
node-version: ${{ matrix.node-version }}
@@ -95,20 +85,19 @@ jobs:
9585
with:
9686
distribution: 'zulu'
9787
java-version: '11'
98-
- name: Build android apk
88+
- name: Build APK
9989
run: |
10090
cd android && ./gradlew assembleRelease
101-
- name: Move release apk to target directory
102-
run: cp android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/${{ steps.set_name.outputs.APK_NAME }}
91+
- name: Move apk to target directory
92+
run: cp android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/${{ env.APK_NAME }}
10393
- name: Release
10494
uses: softprops/action-gh-release@v1
10595
with:
106-
body: ${{steps.build_changelog.outputs.changelog}}
107-
name: ${{ steps.get_version.outputs.PACKAGE_VERSION_NAME }}
108-
tag_name: ${{ steps.get_version.outputs.TAG_NAME }}
96+
body: ${{ steps.build_changelog.outputs.changelog }}
97+
name: ${{ env.PACKAGE_VERSION_NAME }}
98+
tag_name: ${{ env.TAG_NAME }}
10999
files: |
110-
android/app/build/outputs/apk/release/${{ steps.set_name.outputs.APK_NAME }}
111-
${{ steps.set_name.outputs.SOURCE_ZIP_NAME }}
100+
android/app/build/outputs/apk/release/${{ env.APK_NAME }}
112101
env:
113102
GITHUB_TOKEN: ${{ secrets.github_token }}
114103

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,6 @@ Apache-2.0 License © 2021 [funnyzak](https://github.com/funnyzak)
367367
[rle-image]: https://img.shields.io/github/release-date/funnyzak/react-native-v2ex.svg?style=flat-square&label=release
368368
[sg-image]: https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=flat-square
369369
[sg-url]: https://sourcegraph.com/github.com/funnyzak/react-native-v2ex
370-
[build-status-image]: https://github.com/funnyzak/react-native-v2ex/actions/workflows/ci.yml/badge.svg
370+
[build-status-image]: https://github.com/funnyzak/react-native-v2ex/actions/workflows/release.yml/badge.svg
371371
[build-status]: https://github.com/funnyzak/react-native-v2ex/actions
372372
[tag-image]: https://img.shields.io/github/tag/funnyzak/react-native-v2ex.svg

0 commit comments

Comments
 (0)