| 1 | # .gitlab-ci.yml |
| 2 | |
| 3 | # Define stages for the pipeline |
| 4 | stages: |
| 5 | - build |
| 6 | - release |
| 7 | |
| 8 | # Define a job that runs when something is pushed to the master branch |
| 9 | build_job: |
| 10 | stage: build |
| 11 | script: |
| 12 | - apt-get update -qy |
| 13 | - chmod +x ./buildShaders.sh # Ensure the script is executable |
| 14 | - ./buildShaders.sh # Execute the script |
| 15 | - chmod +x ./glbuild.sh # Ensure the script is executable |
| 16 | - ./glbuild.sh # Execute the script |
| 17 | artifacts: |
| 18 | paths: |
| 19 | - js/framework.js |
| 20 | - build_job.env # Ensure the build_job.env file is included in the artifacts |
| 21 | reports: |
| 22 | dotenv: build_job.env |
| 23 | only: |
| 24 | - master # Run this job only when changes are pushed to the master branch |
| 25 | after_script: |
| 26 | # Save the job ID in a .env file to be used by the next job |
| 27 | - echo "BUILD_JOB_ID=$CI_JOB_ID" >> build_job.env |
| 28 | |
| 29 | release_job: |
| 30 | stage: release |
| 31 | image: registry.gitlab.com/gitlab-org/release-cli:latest |
| 32 | dependencies: |
| 33 | - build_job |
| 34 | script: |
| 35 | - echo "running release_job for $TAG" |
| 36 | release: |
| 37 | name: 'v0.$CI_PIPELINE_IID' |
| 38 | tag_name: 'v0.$CI_PIPELINE_IID' # The version is incremented per pipeline. |
| 39 | description: 'v0.$CI_PIPELINE_IID' |
| 40 | ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA. |
| 41 | assets: |
| 42 | links: |
| 43 | - name: 'framework.js' |
| 44 | url: "https://gitlab.com/${CI_PROJECT_PATH}/-/jobs/$BUILD_JOB_ID/artifacts/raw/js/framework.js" |
| 45 | only: |
| 46 | - master # Run this job only when changes are pushed to the master branch |
| 47 | before_script: |
| 48 | - source build_job.env |