Deploy to app store #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to app store | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
deploy: | |
name: Deploy codebase to app store | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
working-directory: cookbook | |
if: github.repository == 'christianlupus-nextcloud/cookbook-releases' | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v4 | |
with: | |
path: cookbook | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Get the date | |
id: date | |
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | |
- name: Use cache for NPM | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.npm | |
cookbook/node_modules | |
key: ${{ runner.os }}-node-${{ steps.date.outputs.date }}-${{ hashFiles('cookbook/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ steps.date.outputs.date }}- | |
${{ runner.os }}-node- | |
- name: Install the NPM packages | |
run: npm ci | |
- name: Build NPM | |
run: npm run build | |
- name: Install composer packages | |
run: make composer_dist | |
- name: Extract app version | |
id: appversion | |
run: | | |
version=$(echo ${{ github.ref }} | sed 's@^refs/tags/@@;s@^v@@i') | |
echo -n "version=" >> $GITHUB_OUTPUT | |
echo "$version" >> $GITHUB_OUTPUT | |
if echo $version | grep '^[0-9]*\.[0-9]*\.[0-9]*$' > /dev/null | |
then | |
echo 'type=stable' >> $GITHUB_OUTPUT | |
else | |
echo 'type=beta' >> $GITHUB_OUTPUT | |
fi | |
- name: Build the appstore package | |
run: make appstore | |
- name: Move the tarball to temp folder | |
run: cp build/artifacts/appstore/cookbook.tar.gz /tmp/cookbook-${{ steps.appversion.outputs.version }}.tar.gz | |
- name: Show the size of the tarball | |
run: ls -lh /tmp/cookbook-${{ steps.appversion.outputs.version }}.tar.gz | |
- name: Create release | |
uses: softprops/[email protected] | |
id: release | |
with: | |
files: /tmp/cookbook-${{ steps.appversion.outputs.version }}.tar.gz | |
prerelease: "${{ steps.appversion.outputs.type == 'beta' }}" | |
- name: Output asset URL | |
run: echo "Download URL is ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}" | |
- name: Upload app to Nextcloud appstore | |
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1 | |
with: | |
app_name: cookbook | |
appstore_token: ${{ secrets.APPSTORE_TOKEN }} | |
download_url: ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }} | |
app_private_key: ${{ secrets.PRIVATE_KEY }} | |