Skip to content

Commit

Permalink
feat: rename workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweii committed Jan 8, 2024
1 parent 5e8dc2d commit 9bcfd40
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 79 deletions.
66 changes: 37 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Release Next Version
on:
push:
branches: [ "main" ]

workflow_dispatch:
inputs:
release_tag:
description: 'Release Tag'
required: true
type: string
env:
NEW_VERSION: ${{ github.event.inputs.release_tag }}
jobs:
release:
if: ${{ startsWith(github.event.head_commit.message, 'release:') }}
release-pr:
runs-on: ubuntu-latest
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
permissions:
contents: write
steps:
Expand All @@ -17,26 +19,32 @@ jobs:
ref: main
fetch-depth: 0
token: ${{ secrets.PROJECT_TOKEN }}
- name: Create new tag
run: |
echo "${{ env.COMMIT_MESSAGE }}"
version=$(echo "${{ env.COMMIT_MESSAGE }}" | grep -oP 'Android \K\d+\.\d+\.\d+')
echo "release_version=$version" >> "$GITHUB_ENV"
echo $version
git config user.name '${{ vars.USER_NAME }}'
git config user.email '${{ vars.USER_EMAIL }}'
git tag v$version
git push origin v$version
- name: Assemble release
- name: Modify for next release
run: |
chmod +x gradlew
./gradlew assembleRelease
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
name: "Clickstream Android $release_version"
files: |
clickstream/build/outputs/aar/clickstream-release.aar
tag_name: "v$release_version"
prerelease: true
generate_release_notes: true
chmod +x release.sh
./release.sh ${{ env.NEW_VERSION }}
git diff
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v5
token: ${{ secrets.PROJECT_TOKEN }}
commit-message: 'release: clickstream Android ${{ env.NEW_VERSION }}'
title: 'release: clickstream Android ${{ env.NEW_VERSION }}'
author: github-actions <[email protected]>
committer: github-actions <[email protected]>
signoff: true
body: |
- [x] PR title and description conform to [Pull Request](https://github.com/awslabs/clickstream-android/blob/main/CONTRIBUTING.md#pull-request-guidelines) guidelines.
*Description of changes:*
1. 'release: clickstream Android ${{ env.NEW_VERSION }}'
*Documentation update required?*
- [ ] No
- [x] Yes (Please include a PR link for the documentation update)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
labels: release
branch: release_${{ env.NEW_VERSION }}
50 changes: 0 additions & 50 deletions .github/workflows/release_pr.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/tag_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create Tag And Release
on:
push:
branches: [ "main" ]

jobs:
release:
if: ${{ startsWith(github.event.head_commit.message, 'release:') }}
runs-on: ubuntu-latest
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
token: ${{ secrets.PROJECT_TOKEN }}
- name: Create new tag
run: |
echo "${{ env.COMMIT_MESSAGE }}"
version=$(echo "${{ env.COMMIT_MESSAGE }}" | grep -oP 'Android \K\d+\.\d+\.\d+')
echo "release_version=$version" >> "$GITHUB_ENV"
echo $version
git config user.name '${{ vars.USER_NAME }}'
git config user.email '${{ vars.USER_EMAIL }}'
git tag v$version
git push origin v$version
- name: Assemble release
run: |
chmod +x gradlew
./gradlew assembleRelease
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
name: "Clickstream Android $release_version"
files: |
clickstream/build/outputs/aar/clickstream-release.aar
tag_name: "v$release_version"
prerelease: true
generate_release_notes: true

0 comments on commit 9bcfd40

Please sign in to comment.