Trigger GitLab Image Pipeline #104
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: Trigger GitLab Image Pipeline | |
on: | |
schedule: | |
- cron: "0 15 * * *" | |
workflow_call: | |
workflow_dispatch: # manual | |
jobs: | |
trigger-pipeline: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get Latest Artifact ID | |
id: get-artifact-id | |
run: | | |
ARTIFACT_ID=$(curl -s "https://api.github.com/repos/nextmcloud/server/actions/workflows" | jq -r '.workflows[0].id') | |
echo "::set-output name=artifact_id::$ARTIFACT_ID" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download versions artifact | |
run: | | |
curl -O -L -J -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/nextmcloud/.github/actions/artifacts/${{ steps.get-artifact-id.outputs.artifact_id }}/zip" | |
unzip versions-combined.zip | |
# Replace username/repo and ARTIFACT_ID with your repository and artifact details | |
- name: Trigger Nmc deployment image building with versions | |
env: | |
GITLAB_TOKEN: ${{ secrets.GITLAB_IMAGE_TRIGGER_TOKEN }} | |
run: | | |
VERSIONS=$(cat versions-combined.txt) | |
curl -X POST \ | |
--fail \ | |
-F token=$GITLAB_TOKEN \ | |
-F ref=master \ | |
-F variables[VERSIONS]="$VERSIONS" \ | |
https://gitlab.devops.telekom.de/api/v4/projects/37742/trigger/pipeline |