Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checkout action ref error #258

Merged
merged 5 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
version:
default: 'latest'
required: false
description: Version to be published (git tag like 'v1.5.2-1.20.4', default to extract from gradle.properties)
description: Version to be published (git tag like 'v1.5.2-1.20.4', default to extract from gradle.properties, DO use default value to build the latest version)

# workflow_call: Or it will be triggered by release workflow
# ref: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_call
Expand Down Expand Up @@ -48,23 +48,34 @@ jobs:
build:
# Run build job only if test job is successfully passed
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds
#
# ref='' for default value (HEAD of main branch) of checkout action
# ref: https://github.com/actions/checkout
name: Run Gradle Build and Preserve Build Files
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ inputs.version == 'latest' && '' || inputs.version }}
ref: ${{ inputs.version == 'latest' && github.ref || inputs.version }}

- name: Fetch latest I18N files
uses: actions/checkout@v3
- name: Fetch Latest Lang Assert
if: ${{ inputs.version == 'latest' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.version == 'latest' && '' || inputs.version }}
# From another repo
# ref: https://github.com/khanshoaib3/minecraft-access
repository: 'khanshoaib3/minecraft-access-i18n'
# Checkout the repo in mod's language assert path
path: './common/src/main/resources/assets/minecraft_access/lang'

- name: Fetch Lang Assert at Given Version
if: ${{ inputs.version != 'latest' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
repository: 'khanshoaib3/minecraft-access-i18n'
path: './common/src/main/resources/assets/minecraft_access/lang'

- name: Set up JDK
uses: actions/setup-java@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/post_github_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# github.repository: owner/repo
# Release API ref: https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release-by-tag-name
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
version:
default: 'latest'
required: false
description: Version to be published (git tag like 'v1.5.2-1.20.4', default to extract from gradle.properties)
description: Version to be published (git tag like 'v1.5.2-1.20.4', default to extract from gradle.properties, DO use default value for pre-release the latest version)
type: string
note:
default: ''
Expand All @@ -32,7 +32,7 @@ env:
UPLOAD_PATH: upload
CHANGELOG_FILE_PATH: ./doc/CHANGELOG.md
MOD_COMPATIBILITY_INFO_FILE_PATH: ./doc/MOD_COMPATIBILITY.md
# Release body for github release
# Release body for GitHub release
CHANGELOG_TEMP_GITHUB: .changelog_github.md
# Release body for modrinth, curseforge
CHANGELOG_TEMP_PLATFORM: .changelog_platform.md
Expand All @@ -46,7 +46,7 @@ jobs:
with:
jdk-version: '17'
build-files-cache-key: ${{ github.run_id }}
version: ${{ inputs.version || 'latest' }}
version: ${{ inputs.version }}

publish:
name: Publish
Expand All @@ -58,13 +58,13 @@ jobs:
runs-on: ubuntu-latest
# ref: https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
release-tag: ${{ steps.env-gradle.outputs.release-tag || inputs.version }}
release-tag: ${{ steps.env.outputs.release-tag || inputs.version }}
steps:
# As long as we checkout right commit at first,
# As long as we check out right commit at first,
# there is no need to modify steps below this checkout step
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ inputs.version == 'latest' && '' || inputs.version }}
ref: ${{ inputs.version == 'latest' && github.ref || inputs.version }}

- name: Restore Cached Mod Files
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
game-versions: ${{ env.MINECRAFT_VERSION }}
java: ${{ env.JAVA_VERSION }}
dependencies: |
architectury-api@${{ env.ARCHY_VERSION }}+forge(required)
architectury-api@${{ env.ARCHY_VERSION }}+minecraftforge(required)
retry-attempts: 2
retry-delay: 60000

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: ${{ inputs.version == 'latest' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
Expand Down