|
| 1 | +name: Release Tagging Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [ created ] |
| 6 | + |
| 7 | +env: |
| 8 | + TAG: ${{ github.ref_name }} |
| 9 | + CI: 1 |
| 10 | + |
| 11 | +jobs: |
| 12 | + preflight-checks: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + submodules: recursive |
| 20 | + |
| 21 | + |
| 22 | + - name: Pre-populate nix-shell |
| 23 | + run: | |
| 24 | + export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) |
| 25 | + echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV |
| 26 | + nix-shell --pure --run "echo" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix |
| 27 | +
|
| 28 | + - name: Login to Docker Hub |
| 29 | + uses: docker/login-action@v3 |
| 30 | + with: |
| 31 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 32 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Validate if the release should be even made |
| 35 | + run: | |
| 36 | + nix-shell --pure --keep CI --keep TAG --run "./dependencies/control-plane/utils/dependencies/scripts/staging/validate.sh \ |
| 37 | + --tag ${{ github.ref_name }} \ |
| 38 | + --type release \ |
| 39 | + --chart true" \ |
| 40 | + ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix |
| 41 | +
|
| 42 | + release-images: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + needs: preflight-checks |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + submodules: recursive |
| 51 | + |
| 52 | + |
| 53 | + - name: Pre-populate nix-shell |
| 54 | + run: | |
| 55 | + export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) |
| 56 | + echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV |
| 57 | + nix-shell --pure --run "echo" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix |
| 58 | +
|
| 59 | + - name: Login to Docker Hub |
| 60 | + uses: docker/login-action@v3 |
| 61 | + with: |
| 62 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 63 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 64 | + |
| 65 | + - name: Login to GHCR |
| 66 | + uses: docker/login-action@v3 |
| 67 | + with: |
| 68 | + registry: ghcr.io |
| 69 | + username: ${{ github.actor }} |
| 70 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + - name: Mirror images from dev to Docker Hub |
| 73 | + run: | |
| 74 | + nix-shell --pure --keep CI --keep TAG --run "./dependencies/control-plane/utils/dependencies/scripts/staging/mirror-images.sh \ |
| 75 | + --source ghcr.io/${{ github.repository_owner }}/mayastor/dev \ |
| 76 | + --target docker.io/${{ github.repository_owner }} \ |
| 77 | + --tag ${{ github.ref_name }} \ |
| 78 | + --chart true" \ |
| 79 | + ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix |
| 80 | +
|
| 81 | + release-kubectl-binaries: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + needs: preflight-checks |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@v4 |
| 87 | + with: |
| 88 | + fetch-depth: 0 |
| 89 | + submodules: recursive |
| 90 | + |
| 91 | + |
| 92 | + - name: Pre-populate nix-shell |
| 93 | + run: | |
| 94 | + export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) |
| 95 | + echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV |
| 96 | + nix-shell --pure --run "echo" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix |
| 97 | +
|
| 98 | + - name: Mirror kubectl artifacts |
| 99 | + env: |
| 100 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 101 | + run: | |
| 102 | + nix-shell --pure --keep CI --keep TAG --run "./dependencies/control-plane/utils/dependencies/scripts/staging/kubectl-oci.sh pull \ |
| 103 | + --tag ${{ github.ref_name }} \ |
| 104 | + --namespace ${{ github.repository_owner }}/mayastor/dev/plugin \ |
| 105 | + --username ${{ github.actor }} \ |
| 106 | + --password ${{ secrets.GITHUB_TOKEN }}" ./dependencies/control-plane/utils/dependencies/scripts/staging/shell.nix |
| 107 | +
|
| 108 | + ./scripts/github/release-artifacts.sh \ |
| 109 | + --tag ${{ github.ref_name }} \ |
| 110 | + --repo-org ${{ github.repository_owner }} \ |
| 111 | + --upload ${{ github.event.repository.name }} \ |
| 112 | + upload |
| 113 | +
|
| 114 | + release-helm-chart: |
| 115 | + runs-on: ubuntu-latest |
| 116 | + needs: [release-images, preflight-checks] |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@v4 |
| 119 | + with: |
| 120 | + fetch-depth: 0 |
| 121 | + submodules: recursive |
| 122 | + |
| 123 | + - name: Login to GHCR |
| 124 | + uses: docker/login-action@v3 |
| 125 | + with: |
| 126 | + registry: ghcr.io |
| 127 | + username: ${{ github.actor }} |
| 128 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 129 | + |
| 130 | + - name: Fetch mayastor chart |
| 131 | + env: |
| 132 | + RAW_TAG: ${{ github.ref_name }} |
| 133 | + IMAGE_ORG: ${{ github.repository_owner }} |
| 134 | + run: | |
| 135 | + VERSION=${RAW_TAG#v} |
| 136 | + echo "CHART_VERSION=$VERSION" >> $GITHUB_ENV |
| 137 | +
|
| 138 | + rm -rf charts |
| 139 | + mkdir -p charts-staged charts-final chart |
| 140 | +
|
| 141 | + CHART_REF=oci://ghcr.io/${IMAGE_ORG}/mayastor/dev/helm/ |
| 142 | + helm pull "$CHART_REF" \ |
| 143 | + --version ${VERSION} \ |
| 144 | + --destination charts-staged |
| 145 | +
|
| 146 | + tar -xzf charts-staged/mayastor-"$VERSION".tgz -C charts-final |
| 147 | +
|
| 148 | + mv charts-final/mayastor/* chart |
| 149 | +
|
| 150 | + - name: Publish helm chart |
| 151 | + uses: stefanprodan/[email protected] |
| 152 | + env: |
| 153 | + TMPDIR: /tmp |
| 154 | + with: |
| 155 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 156 | + charts_dir: . |
| 157 | + |
| 158 | + - name: Publish helm chart as OCI |
| 159 | + |
| 160 | + with: |
| 161 | + name: mayastor |
| 162 | + repository: ${{ github.repository_owner }}/charts |
| 163 | + tag: ${{ env.CHART_VERSION }} |
| 164 | + path: ./chart |
| 165 | + registry: ghcr.io |
| 166 | + registry_username: ${{ github.actor }} |
| 167 | + registry_password: ${{ secrets.GITHUB_TOKEN }} |
| 168 | + update_dependencies: 'false' |
0 commit comments