relock #2207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: relock | |
on: | |
workflow_dispatch: | |
inputs: | |
force_relock: | |
description: 'force the environment to be relocked' | |
required: false | |
type: boolean | |
default: false | |
schedule: | |
- cron: '*/30 * * * *' | |
concurrency: relock | |
jobs: | |
relock: | |
name: relock | |
runs-on: "ubuntu-latest" | |
outputs: | |
relocked: ${{ steps.relock.outputs.relocked }} | |
summary: ${{ steps.relock.outputs.summary }} | |
steps: | |
- name: download env and lockfile | |
run: | | |
wget https://raw.githubusercontent.com/regro/cf-scripts/main/environment.yml | |
wget https://raw.githubusercontent.com/regro/cf-graph-countyfair/master/conda-lock.yml || : | |
- name: relock env | |
id: relock | |
uses: beckermr/relock-conda@49530e32234db1af2014b31a9e7c484488ec5daa | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
action: file | |
relock-all-packages: ${{ inputs.force_relock }} | |
- name: upload conda-lock.yml to artifact | |
if: steps.relock.outputs.relocked == 'true' | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 | |
with: | |
name: conda-lock.yml | |
path: conda-lock.yml | |
tests: | |
needs: relock | |
if: needs.relock.outputs.relocked == 'true' | |
uses: regro/cf-scripts/.github/workflows/tests-reusable.yml@main | |
with: | |
lockfile: conda-lock.yml | |
lockfile-is-artifact: true | |
secrets: | |
CODECOV_TOKEN: "" | |
push: | |
needs: [relock, tests] | |
if: needs.relock.outputs.relocked == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: download conda-lock.yml | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
with: | |
name: conda-lock.yml | |
path: new-lockfile | |
- name: commit and push changes | |
run: | | |
git clone --depth=5 https://github.com/regro/cf-graph-countyfair.git | |
cd cf-graph-countyfair | |
mv ../new-lockfile/conda-lock.yml conda-lock.yml | |
rm -rf new-lockfile | |
git config --global user.name regro-cf-autotick-bot | |
git config --global user.email [email protected] | |
git config --global pull.rebase false | |
git config --global push.autoSetupRemote true | |
git add conda-lock.yml | |
git commit -m "relock w/ conda-lock.yml" | |
for i in `seq 1 5`; do | |
git pull -s recursive -X theirs --no-edit --commit || : | |
git push https://x-access-token:${GH_TOKEN}@github.com/regro/cf-graph-countyfair.git master || : | |
done | |
cd .. | |
set -x | |
git clone --depth=5 https://github.com/regro/cf-scripts.git | |
cd cf-scripts | |
found_one=${{ inputs.force_relock }} | |
for pkg in \ | |
conda-forge-feedstock-ops \ | |
conda conda-build \ | |
mamba \ | |
rattler-build \ | |
conda-forge-feedstock-check-solvable \ | |
conda-libmamba-solver \ | |
conda-forge-metadata \ | |
conda-smithy \ | |
conda-package-handling; \ | |
do | |
val=$(echo "${SUMMARY}" | grep "${pkg}" || echo "") | |
if [[ "${val}" != "" ]]; then | |
found_one=true | |
fi | |
done | |
if [[ "${found_one}" == "true" ]]; then | |
# cf_scripts_branch=relock-env-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER} | |
# git checkout -b ${cf_scripts_branch} | |
cf_scripts_branch=main | |
git commit -m "rebuild for new conda-lock.yml file" --allow-empty | |
for i in `seq 1 5`; do | |
git pull -s recursive -X theirs --no-edit --commit || : | |
git push https://x-access-token:${GH_TOKEN}@github.com/regro/cf-scripts.git ${cf_scripts_branch} || : | |
done | |
# pr_url=$(gh pr -R regro/cf-scripts create -B main -H ${cf_scripts_branch} --fill) | |
# gh pr -R regro/cf-scripts merge ${pr_url} --admin --merge # we already tested above so skip merge queue | |
fi | |
cd .. | |
env: | |
SUMMARY: ${{ needs.relock.outputs.summary }} | |
GH_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} |