All in one, manual #11
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, manual | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: string | |
required: false | |
release: | |
type: choice | |
options: | |
- 'yes' | |
- 'no' | |
run-id: | |
type: number | |
required: false | |
description: Download artifact from this run instead of rebuilding. | |
env: | |
REPO: RocketChat/server-snap | |
SNAP_ARTIFACT_KEY: snap | |
jobs: | |
prereqs: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.REPO }} | |
- shell: bash | |
id: version | |
run: | | |
tag="${{ inputs.tag }}" | |
if [[ -z "$tag" ]]; then # like in case of workflow_dispatch with no tag set | |
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: | |
if: inputs.run-id == '' | |
needs: [ prereqs ] | |
uses: RocketChat/server-snap/.github/workflows/build.yml@develop | |
with: | |
snap-artifact-key: snap #${{ env.SNAP_ARTIFACT_KEY }} | |
tag: ${{ needs.prereqs.outputs.version }} | |
test: | |
needs: [ build, prereqs ] | |
if: | | |
always() && | |
(needs.build.result == 'skipped' || needs.build.result == 'success') | |
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.result == 'success' && needs.build.outputs.snap-basename || format('rocketchat-server_{0}.snap', inputs.tag) }} | |
run-id: ${{ inputs.run-id }} | |
secrets: | |
snapcraft-credential: ${{secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
github-token: ${{secrets.GH_TOKEN_PERSONAL2 }} | |
release: | |
if: | | |
always() && | |
(needs.build.result == 'skipped' || needs.build.result == 'success') && | |
needs.test.result == 'success' && | |
inputs.release == 'yes' | |
needs: | |
- build | |
- test | |
uses: RocketChat/server-snap/.github/workflows/release.yml@develop | |
with: | |
tag: ${{ inputs.tag }} | |
snap-artifact-key: snap #${{ env.SNAP_ARTIFACT_KEY }} | |
snap-basename: ${{ needs.build.result == 'success' && needs.build.outputs.snap-basename || format('rocketchat-server_{0}.snap', inputs.tag) }} | |
secrets: | |
snapcraft-credential: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
github-token: ${{ secrets.GH_TOKEN_PERSONAL2}} |