build(deps): update github actions (main) (major) #3257
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: | |
pull_request: | |
push: | |
branches: | |
- "feature/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout rockcraft | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build rockcraft snap | |
id: build-rockcraft | |
uses: canonical/action-build@v1 | |
- name: Upload rockcraft snap | |
uses: actions/upload-artifact@v4 | |
with: | |
name: snap | |
path: ${{ steps.build-rockcraft.outputs.snap }} | |
- name: Get branch name | |
id: vars | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]] | |
then | |
echo "branch=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT" | |
else | |
branch=$(echo ${GITHUB_REF#refs/*/} | sed -e 's|feature/\(.*\)|\1|') | |
echo "branch=$branch" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Publish feature branch to edge/${{ steps.vars.outputs.branch }} | |
if: ${{ env.SNAPCRAFT_STORE_CREDENTIALS != '' }} | |
uses: canonical/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
with: | |
snap: ${{ steps.build-rockcraft.outputs.snap }} | |
release: edge/${{ steps.vars.outputs.branch }} |