diff --git a/.github/actions/checkout/action.yml b/.github/actions/checkout/action.yml new file mode 100644 index 00000000000..9b0294d3f3d --- /dev/null +++ b/.github/actions/checkout/action.yml @@ -0,0 +1,14 @@ +name: 'Checkout' +description: 'Properly check out (with tags)' +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + if: !startsWith(github.ref, 'refs/tags/') + with: + fetch-depth: 100 + fetch-tags: true + # The action is buggy when building a tag + - run: git fetch origin --tags + shell: bash + if: startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1ebae130bf..6d921c5ffcd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - fetch-tags: true + - uses: ./.github/actions/checkout - uses: ./.github/actions/gradle-setup - name: Generate assets run: ./gradlew runData diff --git a/.github/workflows/export_guide.yml b/.github/workflows/export_guide.yml index ea07b3d3219..94b209cdc44 100644 --- a/.github/workflows/export_guide.yml +++ b/.github/workflows/export_guide.yml @@ -17,10 +17,7 @@ jobs: steps: - name: Install Software OpenGL Rendering run: sudo apt-get install xvfb libgl1-mesa-dri zopfli - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - fetch-tags: true + - uses: ./.github/actions/checkout - uses: ./.github/actions/gradle-setup - name: Export Guide run: DRI_PRIME=0 xvfb-run ./gradlew runGuideexport diff --git a/.github/workflows/localization.yml b/.github/workflows/localization.yml index 8a576a72a35..8cc2db612de 100644 --- a/.github/workflows/localization.yml +++ b/.github/workflows/localization.yml @@ -10,10 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - fetch-tags: true + - uses: ./.github/actions/checkout - uses: ./.github/actions/gradle-setup - uses: actions/setup-node@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98bd5a814a4..f718303fc32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,10 +18,7 @@ jobs: VERSION: ${{ steps.prepare_artifact_metadata.outputs.VERSION }} steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - fetch-tags: true + - uses: ./.github/actions/checkout - uses: ./.github/actions/gradle-setup - name: Build with Gradle env: @@ -92,10 +89,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - fetch-tags: true + - uses: ./.github/actions/checkout - uses: ./.github/actions/gradle-setup - name: Download build artifact uses: actions/download-artifact@v4 @@ -145,10 +139,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - fetch-tags: true + - uses: ./.github/actions/checkout - uses: ./.github/actions/gradle-setup - name: Download build artifact uses: actions/download-artifact@v4