|
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | schedule:
|
5 |
| - # Check for update every day at 07:07 |
6 |
| - - cron: '7 7 * * *' |
| 5 | + # Check for update every day at 07:11 |
| 6 | + - cron: '11 7 * * *' |
7 | 7 | # Allows you to run this workflow manually from the Actions tab
|
8 | 8 | workflow_dispatch:
|
9 | 9 |
|
@@ -48,15 +48,45 @@ jobs:
|
48 | 48 | ]
|
49 | 49 | runs-on: ubuntu-latest
|
50 | 50 | steps:
|
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + type -p curl >/dev/null || sudo apt install curl -y |
| 54 | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg |
| 55 | + sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg |
| 56 | + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null |
| 57 | + sudo apt-get update |
| 58 | + sudo apt-get install gh python3-pip zstd gawk |
| 59 | + pip3 install yq |
| 60 | +
|
51 | 61 | - name: Check for new release
|
52 | 62 | id: check-release
|
53 |
| - uses: bottlesdevs/actions-download-asset@master |
54 |
| - with: |
55 |
| - token: ${{secrets.GITHUB_TOKEN}} |
56 |
| - repo: ${{ matrix.components.repo }} |
57 |
| - version: latest |
58 |
| - file: /${{ matrix.components.name-prefix }}.*[0-9\-_]+\.tar.*/ |
59 |
| - prefix: ${{ matrix.components.version-prefix }} |
| 63 | + shell: bash {0} |
| 64 | + run: | |
| 65 | + latest_release=$(gh release list -R ${{ matrix.components.repo }} | grep -m1 "${{ matrix.components.version-prefix }}" | awk '{print $(NF-1)}') |
| 66 | + if [ -z "$latest_release" ]; then |
| 67 | + echo "::error::Cannot find release tag begining by: ${{ matrix.components.version-prefix }}" |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | + asset_name=" " |
| 71 | + found=false |
| 72 | + i=-1 |
| 73 | + until [ -z "$asset_name" ] || [ "$found" = true ]; do |
| 74 | + i=$((i + 1)) |
| 75 | + asset_name=$(gh release view "$latest_release" --json assets -q ".[] | .[$i] | .name" -R ${{ matrix.components.repo }}) |
| 76 | + if [[ "$asset_name" =~ ${{ matrix.components.name-prefix }}.*[0-9]+\.tar.* ]]; then |
| 77 | + found=true |
| 78 | + fi |
| 79 | + done |
| 80 | + if [ "$found" = false ]; then |
| 81 | + echo "::error::Cannot find asset name begining by: ${{ matrix.components.name-prefix }}" |
| 82 | + exit 1 |
| 83 | + else |
| 84 | + asset_json=$(gh release view "$latest_release" --json assets -q ".[] | .[$i]" -R ${{ matrix.components.repo }}) |
| 85 | + echo "asset=$asset_json" >> $GITHUB_OUTPUT |
| 86 | + echo "version=${latest_release#${{ matrix.components.version-prefix }}}" >> $GITHUB_OUTPUT |
| 87 | + fi |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
60 | 90 |
|
61 | 91 | - uses: actions/checkout@v3
|
62 | 92 | with:
|
|
68 | 98 | repository: bottlesdevs/tools
|
69 | 99 | path: "tools"
|
70 | 100 |
|
71 |
| - - name: Install dependencies |
72 |
| - run: | |
73 |
| - sudo apt-get update |
74 |
| - sudo apt-get install python3-pip zstd |
75 |
| - pip3 install yq |
76 |
| -
|
77 | 101 | - name: Define environment variables
|
78 | 102 | run: |
|
79 | 103 | lowercase_component_name=$(echo "${{ matrix.components.name-prefix }}${{ steps.check-release.outputs.version }}" | tr "[:upper:]" "[:lower:]")
|
|
83 | 107 | echo "SUBCATEGORY=${{ matrix.components.Sub-category }}" >> $GITHUB_ENV
|
84 | 108 | echo "CHANNEL=stable" >> $GITHUB_ENV
|
85 | 109 | echo "YAML_FILENAME=${{ matrix.components.yaml-file }}" >> $GITHUB_ENV
|
86 |
| - echo "CREATED_AT=${{ fromJSON(steps.check-release.outputs.asset).created_at }}" >> $GITHUB_ENV |
| 110 | + echo "CREATED_AT=${{ fromJSON(steps.check-release.outputs.asset).createdAt }}" >> $GITHUB_ENV |
87 | 111 | echo "UPDATED=false" >> $GITHUB_ENV
|
88 | 112 |
|
89 | 113 |
|
|
97 | 121 | if: env.UPDATED == 'true'
|
98 | 122 | working-directory: "bottle-components-repository"
|
99 | 123 | run: |
|
100 |
| - release_archive=${{ steps.check-release.outputs.out }} |
| 124 | + release_archive=${{ fromJSON(steps.check-release.outputs.asset).url }} |
101 | 125 | if [[ $release_archive == *".tar.zst" ]]; then
|
102 | 126 | tar --use-compress-program=unzstd -xvf $release_archive
|
103 | 127 | tar -C "${{ env.NAME }}" -zcvf "${{ env.NAME }}.tar.gz" $(ls ${{ env.NAME }})
|
@@ -163,10 +187,9 @@ jobs:
|
163 | 187 | url="${{ steps.upload-component.outputs.assets && fromJSON(steps.upload-component.outputs.assets)[0].browser_download_url }}"
|
164 | 188 | path="${{ env.UPLOAD_FILE }}"
|
165 | 189 | else
|
166 |
| - url="${{ fromJSON(steps.check-release.outputs.asset).browser_download_url }}" |
167 |
| - path="${{ steps.check-release.outputs.out }}" |
| 190 | + url="${{ fromJSON(steps.check-release.outputs.asset).url }}" |
168 | 191 | fi
|
169 |
| - python "${{ github.workspace }}/tools/MaintainersHelpers/component-generator.py" "components" "${repo%/*}" "${{ env.NAME }}" "${repo%/*}" "${{ env.CHANNEL }}" "$url" "$path" |
| 192 | + python "${{ github.workspace }}/tools/MaintainersHelpers/component-generator.py" "components" "${repo%/*}" "${{ env.NAME }}" "${repo%/*}" "${{ env.CHANNEL }}" "$url" $path |
170 | 193 | # Components specific tweaks
|
171 | 194 | if [[ "${{ env.NAME }}" == "wine-ge"* ]]; then
|
172 | 195 | echo "Post:" >> "${{ env.NAME }}.yml"
|
|
0 commit comments