repomd #6017
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: repomd | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '25 0,6,12,18 * * *' | |
jobs: | |
repomd: | |
runs-on: ubuntu-20.04 | |
env: | |
DO_SPACE_NAME: 'ns8' | |
DO_SPACE_REGION: 'ams3' | |
CDN_DOMAIN: 'distfeed.nethserver.org' | |
steps: | |
- id: checkout | |
uses: actions/checkout@v3 | |
- id: buildmd | |
run: | | |
bash createrepo.sh | |
- name: "Sync registry mirrors" | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
REGISTRY_AUTH_FILE: ./.registryauth.json | |
REGISTRY_GHCR_IO_TOKEN: ${{ secrets.REGISTRY_GHCR_IO_TOKEN }} | |
REGISTRY_DOCKER_IO_TOKEN: ${{ secrets.REGISTRY_DOCKER_IO_TOKEN }} | |
run: | | |
trap 'rm -vf "${REGISTRY_AUTH_FILE}"' exit | |
podman login --password-stdin -u nethbot ghcr.io <<<"${REGISTRY_GHCR_IO_TOKEN:?}" | |
podman login --password-stdin -u nethbot docker.io <<<"${REGISTRY_DOCKER_IO_TOKEN:?}" | |
bash syncmirrors.sh <repodata.json | |
podman logout -a | |
- id: lpublish | |
name: "Publish metadata on GitHub" | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
git config user.name nethbot | |
git config user.email nethbot@nethesis.it | |
BRANCH=$(basename ${{ github.ref }}) | |
COMMIT_MESSAGE="repomd@$BRANCH" | |
REMOTE_BRANCH="repomd" | |
mkdir -p .dst | |
mv repodata.json .dst/ | |
cp -a $(ls -d */) .dst/ | |
git add .dst/ | |
TREE=$(git write-tree --prefix=.dst) | |
COMMIT=$(git commit-tree -m "${COMMIT_MESSAGE}" ${TREE}) | |
git push -f origin $COMMIT:refs/heads/${REMOTE_BRANCH} | |
{ | |
echo "Repository metadata has been published to" | |
echo "" | |
echo "https://raw.githubusercontent.com/${{ github.repository }}/${REMOTE_BRANCH}/repodata.json" | |
echo "" | |
echo "Source" | |
echo "" | |
echo "https://github.com/${{ github.repository }}/tree/${REMOTE_BRANCH}" | |
echo "" | |
} >> $GITHUB_STEP_SUMMARY | |
- id: publish | |
name: "Publish the repository metadata" | |
uses: BetaHuhn/do-spaces-action@v2 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
access_key: ${{ secrets.DO_SPACE_ACCESS_KEY }} | |
secret_key: ${{ secrets.DO_SPACE_SECRET_KEY }} | |
space_name: ${{ env.DO_SPACE_NAME }} | |
space_region: ${{ env.DO_SPACE_REGION }} | |
cdn_domain: ${{ env.CDN_DOMAIN }} | |
source: .dst/ | |
out_dir: ns8/updates/ |