|
| 1 | +name: Promote QA-approved artifacts to stable branch |
| 2 | + |
| 3 | +# - Takes a commit SHA as input |
| 4 | +# - Fast-forward merges it to ionos-stable (no new commits) |
| 5 | +# - Promotes the exact artifact from Artifactory (no rebuild) |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + REGISTRY: ghcr.io |
| 12 | + SHA: ${{ github.sha }} |
| 13 | + ARTIFACTORY_REPOSITORY_SNAPSHOT: ionos-productivity-ncwserver-snapshot |
| 14 | + CACHE_VERSION: v1.0 |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + promote-git: |
| 21 | + # Fast-forward merge SHA from ionos-dev into ionos-stable |
| 22 | + # (This ensures commit-hash is identical) |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout server |
| 26 | + id: checkout_server |
| 27 | + uses: actions/checkout@v5 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Verify SHA is in ionos-dev |
| 32 | + id: verify_sha |
| 33 | + run: | |
| 34 | + git checkout ionos-stable |
| 35 | + git fetch origin ionos-stable ionos-dev |
| 36 | + #verify SHA is on ionos-dev |
| 37 | + if ! git merge-base --is-ancestor "$SHA" origin/ionos-dev; then |
| 38 | + echo "Error: SHA does not exist on ionos-dev: $SHA" |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | + |
| 42 | + - name: Fast-forward merge |
| 43 | + id: ff_merge |
| 44 | + run: | |
| 45 | + # Merge will fail if not possible |
| 46 | + if ! git merge --ff-only "$SHA"; then |
| 47 | + echo "Fast-forward merge not possible" |
| 48 | + exit 1 |
| 49 | + else |
| 50 | + git push origin ionos-stable |
| 51 | + fi |
| 52 | +
|
| 53 | + promote-artifact: |
| 54 | + # Copy specified artifact to the release repo -> No rebuild |
| 55 | + # (ionos-productivity-ncwserver-release) |
| 56 | + needs: promote-git |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - name: Setup JFrog CLI |
| 60 | + id: setup_jf |
| 61 | + uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.4.1 |
| 62 | + env: |
| 63 | + JF_URL: ${{ secrets.JF_ARTIFACTORY_URL }} |
| 64 | + JF_USER: ${{ secrets.JF_ARTIFACTORY_USER }} |
| 65 | + JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} |
| 66 | + |
| 67 | + - name: Ping the JF server |
| 68 | + run: | |
| 69 | + # Ping the server |
| 70 | + jf rt ping |
| 71 | +
|
| 72 | + - name: Find artifacts matching the SHA |
| 73 | + id: find_artifact |
| 74 | + run: | |
| 75 | + if ! jf rt search "ionos-productivity-ncwserver-snapshot/dev/*/$SHA/*.tar.gz"; then |
| 76 | + echo "No artifact with SHA $SHA found." |
| 77 | + exit 1 |
| 78 | + else |
| 79 | + echo "Artifact found for SHA $SHA" |
| 80 | + fi |
| 81 | +
|
| 82 | + - name: Copy artifact to target |
| 83 | + id: copy_artifact |
| 84 | + run: | |
| 85 | + jf rt copy \ |
| 86 | + "ionos-productivity-ncwserver-snapshot/dev/*/$SHA/*" \ |
| 87 | + "ionos-productivity-ncwserver-release/$SHA/" \ |
| 88 | + --flat=false |
| 89 | +
|
0 commit comments