Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from ThePieMonster/ThePieMonster-Workflow
Browse files Browse the repository at this point in the history
Update Workflow v2
  • Loading branch information
ThePieMonster authored Mar 17, 2022
2 parents 200277e + 871c552 commit 462cb2f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 68 deletions.
117 changes: 52 additions & 65 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,8 @@ jobs:
LATESTRELEASETAG=${{ env.LATESTRELEASETAG }}
echo "Gradle Version Name: $VERSIONNAME"
echo "Latest Release Tag: $LATESTRELEASETAG"
if [ "$VERSIONNAME" = "$LATESTRELEASETAG" ]; then echo "Current Gradle Version is the same as GitHubs latest Release tag. This is a tagging conflict and can be resolved by updating the build.gradle file."; exit 1; else echo "All clear!"; fi
# - name: Check If Current Tag Already Exists
# uses: mukunku/[email protected]
# id: checkTag
# with:
# tag: ${{ env.VERSIONNAME }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Output Tag Check
# run: |
# echo "Tag Check: ${{ steps.checkTag.outputs.exists }}"
# echo "TAGCHECK=${{ steps.checkTag.outputs.exists }}" >> $GITHUB_ENV
#
# - name: Create Tag
# if: env.TAGCHECK == format('false')
# uses: actions/github-script@v5
# with:
# script: |
# github.rest.git.createRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: 'refs/tags/${{ env.VERSIONNAME }}',
# sha: context.sha
# })

if [ "$VERSIONNAME" = "$LATESTRELEASETAG" ]; then echo "Current Gradle Version is the same as GitHubs latest Release tag. This will create a tagging conflict when PR is merged due to every PR creating a release. This can be resolved by updating the build.gradle file."; exit 1; else echo "All clear!"; fi
- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
Expand Down Expand Up @@ -159,11 +134,7 @@ jobs:
name: VersionName.txt
path: ${{ github.workspace }}/app/VersionName.txt

# - name: Upload Artifact Changelog
# uses: actions/upload-artifact@v2
# with:
# name: Changelog.txt
# path: ${{ github.workspace }}/app/Changelog.txt


merge_completed:
needs: build
Expand All @@ -174,20 +145,7 @@ jobs:
- name: Display PR Number
run: |
echo "PR #${{ github.event.number }} has been merged"
- name: Get Changelog
uses: mikepenz/release-changelog-builder-action@v2
id: Changelog
with:
configuration: ".github/configs/configuration.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output Changelog
run : |
echo "Output Changelog"
echo "${{ steps.Changelog.outputs.changelog }}"
- name: Download Artifact VersionName
uses: actions/[email protected]
with:
Expand All @@ -199,23 +157,7 @@ jobs:
run : |
echo "Read Gradle VersionName"
echo "VERSIONNAME=$(cat VersionName.txt)" >> $GITHUB_ENV
# - name: Download Artifact Changelog
# uses: actions/[email protected]
# with:
# name: Changelog.txt
# path: ${{ github.workspace }}/artifact

# - name: Read Changelog
# working-directory : ${{ github.workspace }}/artifact
# run : |
# echo "Read Changelog"
# echo "CHANGELOG=$(cat Changelog.txt)" >> $GITHUB_ENV

# - name: Output Changelog
# run : |
# echo "Output Changelog"
# echo "${{ env.CHANGELOG }}"
echo "$VERSIONNAME"
- name: Download Artifact APK
uses: actions/[email protected]
Expand All @@ -228,6 +170,50 @@ jobs:
run : |
echo "${{ github.workspace }}/artifact"
ls -la
- name: Check If Current VersionName Exists As Tag
uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ env.VERSIONNAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output Tag Check
run: |
echo "Tag Check: ${{ steps.checkTag.outputs.exists }}"
echo "TAGCHECK=${{ steps.checkTag.outputs.exists }}" >> $GITHUB_ENV
- name: Tag Exists
if: env.TAGCHECK == format('true')
run: |
echo "Current VersionName Exists As Tag"
exit 1
- name: Create Tag
if: env.TAGCHECK == format('false')
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.VERSIONNAME }}',
sha: context.sha
})
- name: Get Changelog
uses: mikepenz/release-changelog-builder-action@v2
id: Changelog
with:
configuration: ".github/configs/configuration.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output Changelog
run : |
echo "Output Changelog"
echo "${{ steps.Changelog.outputs.changelog }}"
- name: Create Release
id: create_release
Expand All @@ -237,8 +223,7 @@ jobs:
with:
tag_name: ${{ env.VERSIONNAME }}
release_name: ${{ env.VERSIONNAME }}
body: |
${{ env.CHANGELOG }}
body: ${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false

Expand All @@ -264,6 +249,8 @@ jobs:
owner: Xposed-Modules-Repo
repo: com.github.thepiemonster.hidemocklocation



merge_incomplete:
needs: build
if: github.event.pull_request.merged == false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: GitHub Release

on:
workflow_run:
workflows: ["Gradle Build"]
workflows: ["Gradle Build XXX"]
types:
- completed

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.github.thepiemonster.hidemocklocation"
minSdk 30
targetSdk 30
versionCode 206
versionName "2.0.6"
versionCode 207
versionName "2.0.7"
}

signingConfigs {
Expand Down

0 comments on commit 462cb2f

Please sign in to comment.