|
48 | 48 | # Checkout repository -------------------------------------------------------------------- |
49 | 49 | - uses: actions/checkout@v2 |
50 | 50 |
|
| 51 | + # Fix repository permissions |
| 52 | + - name: Fix repository permissions |
| 53 | + run: git config --global --add safe.directory "$PWD" |
| 54 | + |
| 55 | + # Install GitHub CLI |
| 56 | + - name: Install GitHub CLI |
| 57 | + run: .github/workflows/scripts/install-gh-cli.sh |
| 58 | + |
| 59 | + # Checkout release tag (if on release branch) |
| 60 | + - name: Checkout release tag (if on release branch) |
| 61 | + if: github.ref == 'refs/heads/ci-release' |
| 62 | + env: |
| 63 | + GH_TOKEN: ${{ github.token }} |
| 64 | + IMAGE_NAME: ${{ matrix.image }} |
| 65 | + run: | |
| 66 | + git fetch --tags |
| 67 | + latest_tag="$(git tag | grep 'v[0-9]*\.[0-9]*\.[0-9]*' | sort -rn | head -n1)" |
| 68 | + if [ -z "$latest_tag" ]; then |
| 69 | + echo "could not find latest tag" |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + git checkout "$latest_tag" |
| 73 | +
|
51 | 74 | # Build LIBFDS DEB package --------------------------------------------------------------- |
52 | 75 | - name: Checkout libfds library |
53 | 76 | run: git clone https://github.com/CESNET/libfds.git build/libfds_repo |
@@ -82,6 +105,28 @@ jobs: |
82 | 105 | build/pkg/deb/debbuild/*.tar.gz |
83 | 106 | build/pkg/deb/debbuild/*.dsc |
84 | 107 |
|
| 108 | + - name: Publish DEB packages to GitHub releases (latest) |
| 109 | + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci-publish-packages-to-releases' |
| 110 | + env: |
| 111 | + GH_TOKEN: ${{ github.token }} |
| 112 | + IMAGE_NAME: ${{ matrix.image }} |
| 113 | + run: | |
| 114 | + git tag -f ci-latest HEAD && git push -f origin tag ci-latest |
| 115 | + TAG_NAME="ci-latest" ./.github/workflows/scripts/upload-packages.sh |
| 116 | +
|
| 117 | + - name: Publish DEB packages to GitHub releases (stable) |
| 118 | + if: github.ref == 'refs/heads/ci-release' |
| 119 | + env: |
| 120 | + GH_TOKEN: ${{ github.token }} |
| 121 | + IMAGE_NAME: ${{ matrix.image }} |
| 122 | + run: | |
| 123 | + latest_tag="$(git describe --exact-match --tags)" |
| 124 | + if ! gh release view "$latest_tag"; then |
| 125 | + echo "could not find release for tag $latest_tag" |
| 126 | + exit 1 |
| 127 | + fi |
| 128 | + TAG_NAME="$latest_tag" ./.github/workflows/scripts/upload-packages.sh |
| 129 | +
|
85 | 130 | rpm: |
86 | 131 | # Try to build RPM packages |
87 | 132 | runs-on: ubuntu-latest |
@@ -155,6 +200,29 @@ jobs: |
155 | 200 | # Checkout repository -------------------------------------------------------------------- |
156 | 201 | - uses: actions/checkout@v2 |
157 | 202 |
|
| 203 | + # Fix repository permissions |
| 204 | + - name: Fix repository permissions |
| 205 | + run: git config --global --add safe.directory "$PWD" |
| 206 | + |
| 207 | + # Install GitHub CLI |
| 208 | + - name: Install GitHub CLI |
| 209 | + run: .github/workflows/scripts/install-gh-cli.sh |
| 210 | + |
| 211 | + # Checkout release tag (if on release branch) |
| 212 | + - name: Checkout release tag (if on release branch) |
| 213 | + if: github.ref == 'refs/heads/ci-release' |
| 214 | + env: |
| 215 | + GH_TOKEN: ${{ github.token }} |
| 216 | + IMAGE_NAME: ${{ matrix.image }} |
| 217 | + run: | |
| 218 | + git fetch --tags |
| 219 | + latest_tag="$(git tag | grep 'v[0-9]*\.[0-9]*\.[0-9]*' | sort -rn | head -n1)" |
| 220 | + if [ -z "$latest_tag" ]; then |
| 221 | + echo "could not find latest tag" |
| 222 | + exit 1 |
| 223 | + fi |
| 224 | + git checkout "$latest_tag" |
| 225 | +
|
158 | 226 | # Build LIBFDS RPM package --------------------------------------------------------------- |
159 | 227 | - name: Checkout libfds library |
160 | 228 | run: git clone --branch master https://github.com/CESNET/libfds.git build/libfds_repo |
@@ -201,3 +269,25 @@ jobs: |
201 | 269 | path: | |
202 | 270 | build/pkg/rpm/rpmbuild/RPMS/ |
203 | 271 | build/pkg/rpm/rpmbuild/SRPMS/ |
| 272 | +
|
| 273 | + - name: Publish RPM packages to GitHub releases (latest) |
| 274 | + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci-publish-packages-to-releases' |
| 275 | + env: |
| 276 | + GH_TOKEN: ${{ github.token }} |
| 277 | + IMAGE_NAME: ${{ matrix.image }} |
| 278 | + run: | |
| 279 | + git tag -f ci-latest HEAD && git push -f origin tag ci-latest |
| 280 | + TAG_NAME="ci-latest" ./.github/workflows/scripts/upload-packages.sh |
| 281 | +
|
| 282 | + - name: Publish RPM packages to GitHub releases (stable) |
| 283 | + if: github.ref == 'refs/heads/ci-release' |
| 284 | + env: |
| 285 | + GH_TOKEN: ${{ github.token }} |
| 286 | + IMAGE_NAME: ${{ matrix.image }} |
| 287 | + run: | |
| 288 | + latest_tag="$(git describe --exact-match --tags)" |
| 289 | + if ! gh release view "$latest_tag"; then |
| 290 | + echo "could not find release for tag $latest_tag" |
| 291 | + exit 1 |
| 292 | + fi |
| 293 | + TAG_NAME="$latest_tag" ./.github/workflows/scripts/upload-packages.sh |
0 commit comments