chore: adjust app repo and workflow

This commit is contained in:
Adrian Castro
2024-03-28 14:49:18 +01:00
parent 0d730f0096
commit 79220ec8a0
2 changed files with 14 additions and 36 deletions

View File

@@ -172,9 +172,6 @@ jobs:
app-repo:
continue-on-error: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build-ios, release-app]
steps:
@@ -184,38 +181,26 @@ jobs:
- name: Pull version bump
run: git pull --all
- name: Install Node.js
uses: actions/setup-node@v4
- name: Download IPA artifact
uses: actions/download-artifact@v4
with:
node-version: 21
name: ipa
- name: Get new version and release date
id: vars
run: |
VERSION=$(jq -r '.version' apps/expo/package.json)
DATE=$(date -Iseconds)
DATE=$(date -u +"%Y-%m-%d")
echo "::set-output name=version::$VERSION"
echo "::set-output name=date::$DATE"
- name: Update app-repo.json
run: |
IPA_SIZE=$(stat -c%s "movie-web.ipa")
jq --arg IPA_SIZE "$IPA_SIZE" '.apps[0].versions[0].version = "${{ steps.vars.outputs.version }}" | .apps[0].versions[0].date = "${{ steps.vars.outputs.date }}" | .apps[0].versions[0].size = ($IPA_SIZE | tonumber)' apps/expo/app-repo.json > temp.json
mkdir -p pages
mv temp.json pages/repo.json
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
IPA_SIZE=$(stat -f%z "movie-web.ipa")
NEW_ENTRY=$(jq -n --arg version "${{ steps.vars.outputs.version }}" --arg date "${{ steps.vars.outputs.date }}" --arg size "$IPA_SIZE" --arg downloadURL "https://github.com/movie-web/native-app/releases/download/v${{ steps.vars.outputs.version }}/movie-web.ipa" '{version: $version, date: $date, size: ($size | tonumber), downloadURL: $downloadURL}')
jq --argjson newEntry "$NEW_ENTRY" '.apps[0].versions |= [$newEntry] + .' apps/expo/app-repo.json > temp.json && mv temp.json apps/expo/app-repo.json
- uses: EndBug/add-and-commit@v9
with:
source: ./pages
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
default_author: github_actions
message: "chore: update app-repo.json"