All in one, once a day #5
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: All in one, once a day | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: {} | |
env: | |
REPO: RocketChat/server-snap | |
SNAP_ARTIFACT_KEY: snap | |
jobs: | |
prereqs: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
skip: ${{ steps.version.outputs.skip }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.REPO }} | |
ref: 7.x | |
- uses: debdutdeb/semis@main | |
- shell: bash | |
id: version | |
run: | | |
tag="$(curl -s https://releases.rocket.chat/latest/info | jq -r .tag)" | |
if [[ -z "$tag" ]]; then | |
echo "something wrong, releases endpoint returned nothing?" | |
exit 1 | |
fi | |
current="$(awk -F: '/^version:/ {print $2}' snap/snapcraft.yaml | tr -d '[:space:]')" | |
skip=false | |
if semis eq $tag $current; then | |
echo "No new version found" | |
echo "skip=true" >>$GITHUB_OUTPUT | |
exit 0 | |
fi | |
if semis lt $tag $current; then | |
echo "Got version that is less than what is in repo, weird, alarms should go off at this point" | |
echo "skip=true" >>$GITHUB_OUTPUT | |
exit 0 | |
fi | |
echo "skip=$skip" >>$GITHUB_OUTPUT | |
echo "tag: $tag" | |
echo "version=$tag" >> $GITHUB_OUTPUT | |
build: | |
if: needs.prereqs.outputs.skip == 'false' | |
needs: [ prereqs ] | |
uses: RocketChat/server-snap/.github/workflows/build.yml@develop | |
with: | |
tag: ${{ needs.prereqs.outputs.version }} | |
snap-artifact-key: snap #${{ env.SNAP_ARTIFACT_KEY }} | |
test: | |
needs: [ build, prereqs ] | |
uses: RocketChat/server-snap/.github/workflows/test.yml@develop | |
with: | |
tag: ${{ needs.prereqs.outputs.version }} | |
snap-artifact-key: snap #${{ env.SNAP_ARTIFACT_KEY }} | |
snap-basename: ${{needs.build.outputs.snap-basename }} | |
secrets: | |
snapcraft-credential: ${{secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
release: | |
needs: | |
- prereqs | |
- build | |
- test | |
uses: RocketChat/server-snap/.github/workflows/release.yml@develop | |
with: | |
tag: ${{ needs.prereqs.outputs.version }} | |
snap-artifact-key: snap #${{ env.SNAP_ARTIFACT_KEY }} | |
snap-basename: ${{ needs.build.outputs.snap-basename }} | |
secrets: | |
snapcraft-credential: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
github-token: ${{ secrets.GH_TOKEN_PERSONAL }} | |