Skip to content

Commit

Permalink
Merge pull request #56 from ngrok/danielle/fix-not-being-able-to-prom…
Browse files Browse the repository at this point in the history
…ote-to-stable

Fixes not finding snap dir
  • Loading branch information
dthomasngrokker authored Jan 30, 2025
2 parents 828bec7 + 6a1a805 commit 4f5ce81
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
36 changes: 12 additions & 24 deletions .github/workflows/snap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,46 @@ 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]
runs-on: ubuntu-22.04
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
- name: Install snapcraft
run: |
snapcraft --destructive-mode --enable-experimental-target-arch --target-arch=${{ matrix.architecture }}
SNAP_FILE=$(ls *.snap)
echo "snap=$SNAP_FILE" >> $GITHUB_ENV
echo "snap=$SNAP_FILE" >> $GITHUB_OUTPUT
sudo snap install snapcraft --classic
- uses: snapcore/action-build@v1

# Upload the snap file as an artifact
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ngrok-${{ matrix.architecture }}
path: ${{ env.snap }}
name: ngrok-snaps
path: ./*.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
runs-on: ubuntu-22.04
needs: build # Wait for the build job to complete
steps:
- name: Download All Artifacts
- name: Download All Snap Artifacts
uses: actions/download-artifact@v4
with:
path: ngrok
pattern: ngrok-*
path: ngrok-snaps
merge-multiple: true

- run: ls -l ngrok
- run: ls -R

- name: Publish to Snap Store
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
run: |
sudo snap install snapcraft --classic
for snap in ngrok/*.snap; do
for snap in ngrok-snaps/*.snap; do
echo "Publishing $snap"
snapcraft push "$snap" --release=stable
done
5 changes: 2 additions & 3 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: ngrok
adopt-info: ngrok
summary: ngrok secure introspectable tunnels to localhost.
Expand All @@ -23,7 +22,7 @@ architectures: # github actions uses amd64 as host architecture
parts:
ngrok:
plugin: dump # used for unpacking the zip files
source:
source: # location of the source code
- on amd64 to amd64: https://bin.equinox.io/a/cp4zbqoWWC1/ngrok-v3-3.19.1-linux-amd64.zip
- on amd64 to i386: https://bin.equinox.io/a/7RDEFXtBbAj/ngrok-v3-3.19.1-linux-386.zip
- on amd64 to armhf: https://bin.equinox.io/a/fB2XkincXBG/ngrok-v3-3.19.1-linux-arm.zip
Expand All @@ -38,7 +37,7 @@ plugs:
ngrok-config:
interface: personal-files
write:
- $HOME/.ngrok2
- $HOME/.ngrok2

apps:
ngrok:
Expand Down

0 comments on commit 4f5ce81

Please sign in to comment.