Flatpak #2149
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: Flatpak | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '45 21 * * *' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Submodules | |
run: git submodule update --init --recursive | |
- name: Install flatpak | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install flatpak-builder | |
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
- name: Prepare environment | |
run: | | |
SHELL_VERSION=$(git grep -hoP '^\s*VERSION\s*=\s*\K.*$' HEAD -- stremio.pro) | |
FLATPAK_PATH="Stremio $SHELL_VERSION.flatpak" | |
node -e 'process.stdout.write("CURRENT_BRANCH="+process.env.GITHUB_REF.replace(/^refs\/(heads|tags)\//, "")+"\n")' >> $GITHUB_ENV | |
echo SHELL_VERSION=$SHELL_VERSION >> $GITHUB_ENV | |
echo FLATPAK_PATH=$FLATPAK_PATH >> $GITHUB_ENV | |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then echo DEPLOY=false >> $GITHUB_ENV; else echo DEPLOY=true >> $GITHUB_ENV; fi | |
- name: Build | |
run: sudo flatpak-builder --repo=stremio-flatpak-repo --install-deps-from=flathub --force-clean _build com.stremio.Stremio.json | |
- name: Pack | |
run: | | |
flatpak build-bundle stremio-flatpak-repo Stremio.flatpak com.stremio.Stremio beta | |
mv Stremio.flatpak "$FLATPAK_PATH" | |
- name: Store the Flatpak | |
uses: actions/upload-artifact@v1 | |
with: | |
name: StremioFlatpak | |
path: ${{ env.FLATPAK_PATH }} | |
- name: Upload to AWS | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: AKIAJWBFLU34IVITPLHA | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET }} | |
AWS_DEFAULT_REGION: eu-west-1 | |
run: | | |
sudo pip3 install s3cmd | |
if [ "$DEPLOY" = "true" ]; then s3cmd --acl-public --access_key=$AWS_ACCESS_KEY_ID --secret_key=$AWS_SECRET_ACCESS_KEY --force --region=$AWS_DEFAULT_REGION put "$FLATPAK_PATH" s3://stremio-artifacts/shell-linux/$CURRENT_BRANCH/; fi | |
- name: Notify Slack channel | |
uses: rtCamp/action-slack-notify@master | |
env: | |
SLACK_USERNAME: Github Action | |
SLACK_ICON: https://s3-us-west-2.amazonaws.com/slack-files2/bot_icons/2020-10-19/1422366829703_48.png | |
SLACK_TITLE: Github Builds - Flatpak | |
SLACK_CHANNEL: '#installer-ci' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: ${{ !github.event.pull_request }} |