Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Workflow]: Added workflow for automation #9

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/promote-to-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Promote
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved

on:
issue_comment:
types:
- created

permissions:
issues: write

jobs:
promote:
name: ⬆️ Promote to stable
environment: "2204 Branch"
runs-on: ubuntu-latest
if: |
( !github.event.issue.pull_request )
&& contains(github.event.comment.body, '/promote ')
&& contains(github.event.*.labels.*.name, 'testing')
steps:
- name: ⬆️ Promote to stable
uses: snapcrafters/ci/promote-to-stable@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
store-token: ${{ secrets.SNAP_STORE_STABLE }}
snapcraft-project-root: "ffmpeg-2204-sdk"
jnsgruk marked this conversation as resolved.
Show resolved Hide resolved

update-content-snap:
name: Update the content snap
needs: [ release-sdk, get-architectures ]
environment: "2204 Branch"
runs-on: ubuntu-latest
steps:
- name: Checkout latest commit
uses: actions/checkout@v4
with:
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
- name: Update the content snap
uses: snapcrafters/ci/sync-version@main
with:
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
snapcraft-project-root: "ffmpeg-2204"
update-script: |
sed -i 's/^\(- ffmpeg-2204-sdk\/latest\/\)\(.*\)$/\1stable/' ffmpeg-2204/snapcraft.yaml

release-content:
name: 🚢 Release to latest/stable
needs: get-architectures
runs-on: ubuntu-latest
environment: "2204 Branch"
strategy:
matrix:
architecture: ${{ fromJSON(needs.get-architectures.outputs.architectures-list) }}
steps:
- name: 🚢 Release to latest/stable
uses: snapcrafters/ci/release-to-candidate@main
with:
architecture: ${{ matrix.architecture }}
launchpad-token: ${{ secrets.LP_BUILD_SECRET }}
store-token: ${{ secrets.SNAP_STORE_CANDIDATE }}
channel: "stable"
snapcraft-project-root: "ffmpeg-2204"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what update-content-snap and release-content is doing here. The promote to stable workflow should only promote already built snaps to stable. It should not build anything.

19 changes: 19 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Pull Request

on:
pull_request:
branches: [ "**" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: 🧪 Build snap on amd64
runs-on: ubuntu-latest
steps:
- name: 🧪 Build snap on amd64
uses: snapcrafters/ci/test-snap-build@main
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved
with:
snapcraft-project-root: ffmpeg-2204-sdk
116 changes: 116 additions & 0 deletions .github/workflows/release-to-edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Release
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved

on:
# Run the workflow each time new commits are pushed to the candidate branch.
push:
branches: [ "2204" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
issues: write

jobs:
get-architectures:
name: 🖥 Get snap architectures
runs-on: ubuntu-latest
outputs:
architectures: ${{ steps.get-architectures.outputs.architectures }}
architectures-list: ${{ steps.get-architectures.outputs.architectures-list }}
steps:
- name: 🖥 Get snap architectures
id: get-architectures
uses: snapcrafters/ci/get-architectures@main
with:
snapcraft-project-root: "ffmpeg-2204-sdk"

release-sdk:
name: 🚢 Release to latest/candidate
needs: get-architectures
runs-on: ubuntu-latest
environment: "2204 Branch"
strategy:
matrix:
architecture: ${{ fromJSON(needs.get-architectures.outputs.architectures-list) }}
steps:
- name: 🚢 Release to latest/edge
uses: snapcrafters/ci/release-to-candidate@main
with:
architecture: ${{ matrix.architecture }}
channel: "candidate-${{ github.event.number }}"
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved
launchpad-token: ${{ secrets.LP_BUILD_SECRET }}
snapcraft-project-root: "ffmpeg-2204-sdk"
store-token: ${{ secrets.SNAP_STORE_CANDIDATE }}

update-content-snap:
name: Update the content snap
needs: [ release-sdk, get-architectures ]
environment: "2204 Branch"
runs-on: ubuntu-latest
steps:
- name: Update the content snap
uses: snapcrafters/ci/sync-version@main
with:
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
snapcraft-project-root: "ffmpeg-2204"
update-script: |
sed -i 's/^\(- ffmpeg-2204-sdk\/latest\/\)stable$/\1candidate-${{ github.event.number }}/' ffmpeg-2204/snapcraft.yaml
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved

release-content:
name: 🚢 Release to latest/edge
needs: get-architectures
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs update-content-snap too

runs-on: ubuntu-latest
environment: "2204 Branch"
strategy:
matrix:
architecture: ${{ fromJSON(needs.get-architectures.outputs.architectures-list) }}
steps:
- name: Checkout latest commit
uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still checks out the commit associated with this action; not the latest commit. You can checkout the latest commit using this method: https://github.com/actions/checkout#checkout-head

with:
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
- name: 🚢 Release to latest/edge
uses: snapcrafters/ci/release-to-candidate@main
with:
architecture: ${{ matrix.architecture }}
channel: "edge-${{ github.event.number }}"
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved
launchpad-token: ${{ secrets.LP_BUILD_SECRET }}
snapcraft-project-root: "ffmpeg-2204"
store-token: ${{ secrets.SNAP_STORE_CANDIDATE }}

call-for-testing:
name: 📣 Create call for testing
needs: [release-sdk, get-architectures]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs release-content, so the call for testing only gets published when both SDK and content succeed

environment: "2204 Branch"
runs-on: ubuntu-latest
outputs:
issue-number: ${{ steps.issue.outputs.issue-number }}
steps:
- name: 📣 Create call for testing
id: issue
uses: snapcrafters/ci/call-for-testing@main
with:
architectures: ${{ needs.get-architectures.outputs.architectures }}
github-token: ${{ secrets.GITHUB_TOKEN }}
snapcraft-project-root: "ffmpeg-2204-sdk"

call-for-testing-content:
name: 📣 Create call for testing
needs: [release-content, get-architectures]
environment: "2204 Branch"
runs-on: ubuntu-latest
outputs:
issue-number: ${{ steps.issue.outputs.issue-number }}
steps:
- name: 📣 Create call for testing
id: issue
uses: snapcrafters/ci/call-for-testing@main
with:
architectures: ${{ needs.get-architectures.outputs.architectures }}
github-token: ${{ secrets.GITHUB_TOKEN }}
snapcraft-project-root: "ffmpeg-2204"

29 changes: 0 additions & 29 deletions .github/workflows/test-snap-can-build.yml

This file was deleted.

1 change: 0 additions & 1 deletion ffmpeg-2204-sdk/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ parts:
make DESTDIR="$CRAFT_PART_INSTALL" install
prime:
- -usr/share
source-tag: release/6.1
prefix-fix:
after: [ffmpeg]
plugin: nil
Expand Down
Loading