Skip to content

Artifacts

Artifacts #4135

Workflow file for this run

name: "Artifacts"
on:
push:
branches: [ master ]
schedule:
- cron: '0 */12 * * *'
permissions: write-all
jobs:
artifacts:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Artifacts
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
git fetch --depth 1 origin +refs/tags/artifacts:refs/tags/artifacts --no-tags
bash --noprofile --norc -e -o pipefail docs/tools/actions-artifacts.sh
export GIT_AUTHOR_DATE="$(git log -1 --format=%aD)"
export GIT_COMMITTER_DATE="$(git log -1 --format=%cD)"
git -c user.name="GitHub" -c user.email="[email protected]" commit --author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -m"Add vendored Node modules
Node modules and their dependencies updated to the latest versions found in https://github.com/${{ github.repository }}/blob/master/package.json" | sed -n 1p
git checkout -- '.gitignore'
if [[ $(git status --porcelain | tee /dev/stderr | head -c1 | wc -c) -ne 0 || $(git clean -dffx | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
# Artifacts
git tag -f artifacts
git push -f origin refs/tags/artifacts:refs/tags/artifacts
readme:
runs-on: ubuntu-latest
needs: artifacts
if: needs.artifacts.result == 'success'
steps:
- uses: actions/[email protected]
- name: README
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
git fetch --depth 1 origin +refs/tags/artifacts:refs/tags/artifacts --no-tags
git restore --source=artifacts -- bin/ node_modules/ package-lock.json
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
bin/linux/x64/node/node-v$node_version-linux-x64/bin/node --use_strict index.js --readme_only
rm -r bin/
rm -r node_modules/
rm package-lock.json
git checkout -- downloadlist.json
git add README.html README.md
git -c user.name="GitHub" -c user.email="[email protected]" commit --author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -m"Update README" | sed -n 1p || true
if [[ $(git status --porcelain | tee /dev/stderr | head -c1 | wc -c) -ne 0 || $(git clean -dffx | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
- id: cpr
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update README
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: GitHub <[email protected]>
title: Update README
body: |
Update the README to reflect the latest changes.
labels: automerge
branch: actions/readme
base: master
- name: get repository name
if: ${{ steps.cpr.outputs.pull-request-number }}
shell: bash
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: automerge
if: ${{ steps.cpr.outputs.pull-request-number }}
uses: actions/[email protected]
with:
script: |
github.rest.pulls.merge({
owner: '${{ github.repository_owner }}',
repo: '${{ env.REPOSITORY_NAME }}',
pull_number: '${{ steps.cpr.outputs.pull-request-number }}',
sha: '${{ steps.cpr.outputs.pull-request-head-sha }}',
merge_method: 'merge'
})
downloadlist:
runs-on: ubuntu-latest
needs: artifacts
if: needs.artifacts.result == 'success'
steps:
- uses: actions/[email protected]
- name: Downloadlist
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
git fetch --depth 1 origin +refs/tags/artifacts:refs/tags/artifacts --no-tags
git restore --source=artifacts -- bin/ node_modules/ package-lock.json
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
bin/linux/x64/node/node-v$node_version-linux-x64/bin/node --use_strict index.js --readme_only
rm -r bin/
rm -r node_modules/
rm package-lock.json
git checkout -- README.html README.md
git add downloadlist.json
git -c user.name="GitHub" -c user.email="[email protected]" commit --author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -m"Update downloadlist" | sed -n 1p || true
if [[ $(git status --porcelain | tee /dev/stderr | head -c1 | wc -c) -ne 0 || $(git clean -dffx | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
- id: cpr
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update downloadlist
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: GitHub <[email protected]>
title: Update downloadlist
body: |
Update the downloadlist to reflect the latest changes.
labels: automerge
branch: actions/downloadlist
base: master
- name: get repository name
if: ${{ steps.cpr.outputs.pull-request-number }}
shell: bash
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: automerge
if: ${{ steps.cpr.outputs.pull-request-number }}
uses: actions/[email protected]
with:
script: |
github.rest.pulls.merge({
owner: '${{ github.repository_owner }}',
repo: '${{ env.REPOSITORY_NAME }}',
pull_number: '${{ steps.cpr.outputs.pull-request-number }}',
sha: '${{ steps.cpr.outputs.pull-request-head-sha }}',
merge_method: 'merge'
})
engines:
runs-on: ubuntu-latest
needs: artifacts
if: needs.artifacts.result == 'success'
steps:
- uses: actions/[email protected]
- name: Engines
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
git fetch --depth 1 origin +refs/tags/artifacts:refs/tags/artifacts --no-tags
git restore --source=artifacts -- bin/ node_modules/
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
sed -i "0,/\"npm\": \".*\"/s//\"npm\": \"$(cat bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/package.json | python -c "import sys, json; print(json.load(sys.stdin)['version'])") || $(cat node_modules/npm/package.json | python -c "import sys, json; print(json.load(sys.stdin)['version'])")\"/" package.json
rm -r bin/ node_modules/
- id: cpr
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update engines
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: GitHub <[email protected]>
title: Update engines
body: |
Update the engines field.
labels: automerge
branch: actions/engines
base: master
- name: get repository name
if: ${{ steps.cpr.outputs.pull-request-number }}
shell: bash
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: automerge
if: ${{ steps.cpr.outputs.pull-request-number }}
uses: actions/[email protected]
with:
script: |
github.rest.pulls.merge({
owner: '${{ github.repository_owner }}',
repo: '${{ env.REPOSITORY_NAME }}',
pull_number: '${{ steps.cpr.outputs.pull-request-number }}',
sha: '${{ steps.cpr.outputs.pull-request-head-sha }}',
merge_method: 'merge'
})
bundled:
runs-on: ubuntu-latest
needs: artifacts
if: needs.artifacts.result == 'success'
steps:
- uses: actions/[email protected]
- name: Bundled
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
git fetch --depth 1 origin +refs/tags/artifacts:refs/tags/artifacts --no-tags
git restore --source=artifacts -- node_modules/
sed -i -z 's| "bundleDependencies": \[\n ".*"\n \]| "bundleDependencies": \[\n'"$(printf ' "%s",\\n' $(find node_modules/ -mindepth 2 -maxdepth 3 -type f -name 'package.json' -exec bash -c 'path={}; echo "${path:13:-13}"' ';' | sort) | sed '$ s/...$//')"'\n \]|' -- 'package.json'
rm -r node_modules/
- id: cpr
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update bundleDependencies
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: GitHub <[email protected]>
title: Update bundleDependencies
body: |
Update the bundleDependencies field.
labels: automerge
branch: actions/bundled
base: master
- name: get repository name
if: ${{ steps.cpr.outputs.pull-request-number }}
shell: bash
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: automerge
if: ${{ steps.cpr.outputs.pull-request-number }}
uses: actions/[email protected]
with:
script: |
github.rest.pulls.merge({
owner: '${{ github.repository_owner }}',
repo: '${{ env.REPOSITORY_NAME }}',
pull_number: '${{ steps.cpr.outputs.pull-request-number }}',
sha: '${{ steps.cpr.outputs.pull-request-head-sha }}',
merge_method: 'merge'
})
artifacts_jsonlint:
runs-on: ubuntu-latest
needs: artifacts
if: needs.artifacts.result == 'success'
steps:
- name: Build demjson
shell: bash
run: |
pip install setuptools==57.5.0
pip install git+https://github.com/EIGHTFINITE/demjson.git@master
- uses: actions/[email protected]
with:
ref: artifacts
- name: jsonlint
shell: bash
run: |
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
# Forbid all
if [[ $(find . -type f -path ./.git -prune -o -path ./bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/node_modules/iconv-lite/encodings/tables -prune -o -path ./bin/windows/x64/node/node-v$node_version-win-x64/node_modules/npm/node_modules/iconv-lite/encodings/tables -prune -o -path ./node_modules/iconv-lite/encodings/tables -prune -o -path ./node_modules/npm-6/node_modules/iconv-lite/encodings/tables -prune -o -name '*.json' -exec jsonlint -s --forbid any-type-at-start,bom,duplicate-keys,non-portable,non-bmp,zero-byte -e utf8 -- '{}' ';' | grep -v -e ': ok' -e ': has errors' | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
# Allow non-bmp, zero-byte
if [[ $(find ./bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/node_modules/iconv-lite/encodings/tables ./bin/windows/x64/node/node-v$node_version-win-x64/node_modules/npm/node_modules/iconv-lite/encodings/tables ./node_modules/iconv-lite/encodings/tables ./node_modules/npm-6/node_modules/iconv-lite/encodings/tables -type f -name '*.json' -exec jsonlint -s --allow non-bmp,zero-byte --forbid any-type-at-start,bom,duplicate-keys,non-portable -e utf8 -- '{}' ';' | grep -v -e ': ok' -e ': has errors' | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
artifacts_install:
runs-on: ubuntu-latest
needs: artifacts
if: needs.artifacts.result == 'success'
steps:
- uses: actions/[email protected]
with:
ref: artifacts
path: DownloadItYourself
- name: install
shell: bash
run: |
cd DownloadItYourself
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
sed -i '/cache-max = 0/d' -- '.npmrc'
sed -i '/only = prod/d' -- '.npmrc'
sed -i '/optional = false/d' -- '.npmrc'
sed -i '/production = true/d' -- '.npmrc'
if [[ "$OSTYPE" == "msys" ]]; then
bin/windows/x64/node/node-v$node_version-win-x64/node.exe bin/windows/x64/node/node-v$node_version-win-x64/node_modules/npm/bin/npm-cli.js ls || true
else
cat bin/linux/x64/node/node-v$node_version-linux-x64/bin/node.* > bin/linux/x64/node/node-v$node_version-linux-x64/bin/node
chmod +x bin/linux/x64/node/node-v$node_version-linux-x64/bin/node
bin/linux/x64/node/node-v$node_version-linux-x64/bin/node bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/bin/npm-cli.js ls || true
rm bin/linux/x64/node/node-v$node_version-linux-x64/bin/node
fi
rm -rf .npm/
git checkout -- '.npmrc'
# Ignore peerDependencies
sed -i '/"peerDependencies": {/,/}/d' -- 'package.json'
cd ..
echo '{
"private": "true"
}' > package.json
cp DownloadItYourself/.npmrc .npmrc
if [[ "$OSTYPE" == "msys" ]]; then
DownloadItYourself/bin/windows/x64/node/node-v$node_version-win-x64/node.exe DownloadItYourself/bin/windows/x64/node/node-v$node_version-win-x64/node_modules/npm/bin/npm-cli.js install ./DownloadItYourself
else
cat DownloadItYourself/bin/linux/x64/node/node-v$node_version-linux-x64/bin/node.* > DownloadItYourself/bin/linux/x64/node/node-v$node_version-linux-x64/bin/node
chmod +x DownloadItYourself/bin/linux/x64/node/node-v$node_version-linux-x64/bin/node
DownloadItYourself/bin/linux/x64/node/node-v$node_version-linux-x64/bin/node DownloadItYourself/bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/bin/npm-cli.js install ./DownloadItYourself
rm DownloadItYourself/bin/linux/x64/node/node-v$node_version-linux-x64/bin/node
fi
rm -rf .npm/
artifacts_audit:
runs-on: ubuntu-latest
needs: [artifacts_install]
if: ${{ needs.artifacts_install.result == 'success' }}
steps:
- uses: actions/[email protected]
with:
ref: artifacts
- name: audit
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
bash --noprofile --norc -e -o pipefail docs/tools/actions-audit.sh
release:
runs-on: ubuntu-latest
needs: [artifacts_jsonlint, artifacts_audit]
if: ${{ needs.artifacts_jsonlint.result == 'success' && needs.artifacts_audit.result == 'success' }}
steps:
- uses: actions/[email protected]
with:
ref: artifacts
- name: Release
shell: bash
run: |
bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh
export GIT_AUTHOR_DATE="$(git log -1 --format=%aD)"
export GIT_COMMITTER_DATE="$(git log -1 --format=%cD)"
# Update downloadlist files
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
# bin/linux/x64/node/node-v$node_version-linux-x64/bin/node --use_strict index.js --update_single_file_daily
git checkout -- 'README.html'
git checkout -- 'README.md'
git clean -ffx MultiMC/
git clean -ffx _download/
git clean -ffx minecraft/
git clean -ffx server/
if [[ $(git status --porcelain | tee /dev/stderr | head -c1 | wc -c) -ne 0 || $(git clean -dffx | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
# Release
git tag -f latest
git push -f origin refs/tags/latest:refs/tags/latest
release_jsonlint:
runs-on: ubuntu-latest
needs: release
if: needs.release.result == 'success'
steps:
- name: Build demjson
shell: bash
run: |
pip install setuptools==57.5.0
pip install git+https://github.com/EIGHTFINITE/demjson.git@master
- uses: actions/[email protected]
with:
ref: latest
- name: jsonlint
shell: bash
run: |
export node_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['engines']['node'])")
# Forbid all
if [[ $(find . -type f -path ./.git -prune -o -path ./bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/node_modules/iconv-lite/encodings/tables -prune -o -path ./bin/windows/x64/node/node-v$node_version-win-x64/node_modules/npm/node_modules/iconv-lite/encodings/tables -prune -o -path ./node_modules/iconv-lite/encodings/tables -prune -o -path ./node_modules/npm-6/node_modules/iconv-lite/encodings/tables -prune -o -name '*.json' -exec jsonlint -s --forbid any-type-at-start,bom,duplicate-keys,non-portable,non-bmp,zero-byte -e utf8 -- '{}' ';' | grep -v -e ': ok' -e ': has errors' | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi
# Allow non-bmp, zero-byte
if [[ $(find ./bin/linux/x64/node/node-v$node_version-linux-x64/lib/node_modules/npm/node_modules/iconv-lite/encodings/tables ./bin/windows/x64/node/node-v$node_version-win-x64/node_modules/npm/node_modules/iconv-lite/encodings/tables ./node_modules/iconv-lite/encodings/tables ./node_modules/npm-6/node_modules/iconv-lite/encodings/tables -type f -name '*.json' -exec jsonlint -s --allow non-bmp,zero-byte --forbid any-type-at-start,bom,duplicate-keys,non-portable -e utf8 -- '{}' ';' | grep -v -e ': ok' -e ': has errors' | tee /dev/stderr | head -c1 | wc -c) -ne 0 ]]
then exit 1
fi