Skip to content

Update Latest

Update Latest #25

Workflow file for this run

#
# AppScope - Update Latest Workflow
#
# Update what is returned by https://cdn.cribl.io/dl/scope/latest
# And update the "latest" tag on https://hub.docker.com/r/cribl/scope/tags
#
# based on:
# https://levelup.gitconnected.com/how-to-manually-trigger-a-github-actions-workflow-4712542f1960
# instructions for use:
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
#
name: Update Latest
on:
workflow_dispatch:
jobs:
info:
name: Validate Git Tag
runs-on: ubuntu-latest
steps:
- name: Get Version
id: version
uses: Simply007/get-version-action@v2.3.0
- name: Get Tag
id: tag
run: |
if [ -z "${GITHUB_REF%%refs/tags/v*}" -a "true" = "${{ steps.version.outputs.is-semver }}" ]; then
echo "tag=${{ steps.version.outputs.version-without-v }}" >> "${GITHUB_OUTPUT}"
fi
- name: Echo Outputs
run: |
echo "version=\"${{ steps.version.outputs.version }}\""
echo "major=\"${{ steps.version.outputs.major }}\""
echo "minor=\"${{ steps.version.outputs.minor }}\""
echo "maintenance=\"${{ steps.version.outputs.patch }}\""
echo "prerelease=\"${{ steps.version.outputs.prerelease }}\""
echo "build=\"${{ steps.version.outputs.build }}\""
echo "is-semver=\"${{ steps.version.outputs.is-semver }}\""
echo "tag=\"${{ steps.tag.outputs.tag }}\""
- name: Check Tag
run: |
if [ "${{ steps.tag.outputs.tag }}" == '' ]; then
echo "The git version ${{ steps.version.outputs.version }} is not usable..."
echo " It must start with a v, and be a valid semantic version"
exit 1
fi
if [ "${{ steps.version.outputs.prerelease }}" != '' ]; then
echo "The git version ${{ steps.version.outputs.version }} is not usable..."
echo " It must not be a prerelease"
exit 1
fi
outputs:
prerelease: ${{ steps.version.outputs.prerelease }}
tag: ${{ steps.tag.outputs.tag }}
update-cdn-latest:
name: Update CDN Latest
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
needs: info
steps:
- name: configure AWS creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.APPSCOPEDEPLOYROLE }}
role-session-name: appscope-deploy
aws-region: us-west-2
- name: Update dl/scope/latest
env:
CF_DISTRIBUTION_ID: ${{ secrets.CF_DISTRIBUTION_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "::group::Updating https://cdn.cribl.io/dl/scope/latest to ${{ needs.info.outputs.tag }}"
S3_SCOPE=s3://io.cribl.cdn/dl/scope
TMPDIR=${RUNNER_TEMP}
if [ -n "${{ needs.info.outputs.tag }}" ]; then
echo "${{ needs.info.outputs.tag }}" > ${TMPDIR}/latest
aws s3 cp ${TMPDIR}/latest ${S3_SCOPE}/latest
aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --paths '/dl/scope/latest'
fi
echo "::endgroup::"
update-dockerhub-latest:
name: Update Latest Tag in Dockerhub
runs-on: ubuntu-latest
needs: [info,update-cdn-latest]
steps:
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: scopeci
password: ${{ secrets.SCOPECI_TOKEN }}
- name: Setup Crane
uses: imjasonh/setup-crane@v0.3
- name: Update the Latest Tag
run: |
crane tag cribl/scope:${{ needs.info.outputs.tag }} latest
- name: Print Digest/Manifest Information
run: |
echo "digest and manifest for cribl/scope:${{ needs.info.outputs.tag }}"
crane digest cribl/scope:${{ needs.info.outputs.tag }}
crane manifest cribl/scope:${{ needs.info.outputs.tag }} | jq .
echo "digest and manifest for cribl/scope:latest"
crane digest cribl/scope:latest
crane manifest cribl/scope:latest | jq .