Skip to content

Build, test and release snap #6

Build, test and release snap

Build, test and release snap #6

Workflow file for this run

name: Build, test and release snap
on:
workflow_call:
inputs:
tag:
type: string
required: true
secrets:
snapcraft-credential:
required: true
github-token:
required: true
workflow_dispatch:
# this trigger uses existing version for release
jobs:
prereqs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps._id.outputs.version }}
steps:
- uses: actions/checkout@v3
if: github.event_name == 'workflow_dispatch'
- shell: bash
id: _id
run: |
tag=
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
tag="$(awk -F: '/^version:/ {print $2}' snap/snapcraft.yaml | tr -d '[:space:]')"
else
tag="${{inputs.tag}}"
fi
echo "tag: $tag"
echo "version=$tag" >> $GITHUB_OUTPUT
build-and-test:
needs: [ prereqs ]
uses: RocketChat/server-snap/.github/workflows/test.yml@develop
with:
tag: ${{ needs.prereqs.outputs.version }}
secrets:
snapcraft-credential: ${{ secrets.snapcraft-credential }}
release:
if: '! contains(inputs.tag, ''rc'')'
needs:
- build-and-test
uses: RocketChat/server-snap/.github/workflows/release.yml@develop
with:
snap: ${{ needs.build-and-test.outputs.snap-basename }}
snap-track: ${{ needs.build-and-test.outputs.snap-track }}
commit: ${{ needs.build-and-test.outputs.commit }}
tag: ${{ inputs.tag }}
secrets:
snapcraft-credential: ${{ secrets.snapcraft-credential }}
github-token: ${{ secrets.github-token }}