snap #58
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: snap | |
on: # The event that triggers the workflow | |
push: | |
branches: | |
- master # When a commit is created on master | |
pull_request: | |
branches: | |
- master # When a pull request is opened against master | |
workflow_dispatch: # When the workflow is manually triggered | |
jobs: | |
build: | |
# Only run this job if the branch name contains "release" or a commit is created on master branch and the branch name contains "release" or manually triggered | |
if: contains(github.ref, 'release') || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: [amd64, i386, armhf, arm64, s390x] #ppc64le] | |
outputs: | |
snap-file: ${{ steps.build-snap.outputs.snap }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Snapcraft | |
run: sudo snap install snapcraft --classic | |
- name: Install Multipass | |
run: sudo snap install multipass --classic | |
- name: Build the snap # Build the snap for the specified architecture in the matrix strategy above and save the snap file path to an output | |
id: build-snap | |
run: | | |
snapcraft --destructive-mode --enable-experimental-target-arch --target-arch=${{ matrix.architecture }} | |
SNAP_FILE=$(ls *.snap) | |
echo "snap=$SNAP_FILE" >> $GITHUB_ENV | |
# Upload the snap file as an artifact | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ngrok-${{ matrix.architecture }} | |
path: ${{ env.snap }} | |
publish: | |
# Only run this job if the branch name contains "release" or a commit is created on master branch and the branch name contains "release" or manually triggered | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.ref, 'release')) || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
needs: build # Wait for build job to be done | |
steps: | |
- name: Download package | |
uses: actions/download-artifact@v4 | |
with: | |
name: ngrok-${{ matrix.architecture }} | |
path: . | |
- name: Publish to Snap Store | |
uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | |
with: | |
snap: ${{needs.build.outputs.snap-file}} | |
release: stable |