diff options
Diffstat (limited to '')
| -rw-r--r-- | .github/workflows/release.yml | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 94a57f6..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: release - -concurrency: - group: release-${{ github.ref_name }} - cancel-in-progress: true - -on: - workflow_dispatch: - inputs: - version: - description: "Impact" - required: true - default: 'patch' - type: choice - options: - - minor - - patch - dry_run: - description: "Dry run" - required: false - default: false - type: boolean - -permissions: - contents: write - -jobs: - linux: - if: ${{ github.ref_name != 'master' && startsWith(github.ref_name, 'v') && endsWith(github.ref_name, '.x') }} - runs-on: ubuntu-latest - strategy: - matrix: - go-version: [1.26.4] - - steps: - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - id: go - - - name: Check out code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install ffmpeg - run: | - set -euxo pipefail - sudo apt-get update - sudo apt-get install -y --no-install-recommends ffmpeg - - - name: Generate test data - run: | - set -euxo pipefail - ./test-data/generate.sh - ./test-data/generate-av1.sh - - curl -fL --retry 3 \ - -o test-data/big-buck-bunny-480p-30sec.mp4 \ - https://raw.githubusercontent.com/chthomos/video-media-samples/master/big-buck-bunny-480p-30sec.mp4 - - - name: Run tests and benchmarks - run: go test -bench=. -benchmem ./... - - - name: Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -euxo pipefail - - git fetch --all --tags - - MAJOR=$(echo "$GITHUB_REF_NAME" | sed -nE 's/^v([0-9]+)\.x$/\1/p') - if [[ -z "$MAJOR" ]]; then - echo "Invalid branch name format (expected vX.x)" >&2 - exit 1 - fi - - next_version () { - local current impact MINOR PATCH - impact="${1:-patch}" - - current=$(git tag | grep "^v${MAJOR}\.[0-9]*\.[0-9]*$" | sort -t "." -k1,1nr -k2,2nr -k3,3nr | cut -c2- | head -1) || true - - if [[ -z "$current" ]]; then - if [[ "$MAJOR" -eq 0 ]]; then - echo "0.1.0" - else - echo "$MAJOR.0.0" - fi - return - fi - - IFS='.' read -r _ MINOR PATCH <<< "$current" - - case "$impact" in - minor) - ((MINOR+=1)) - PATCH=0 - ;; - patch) - ((PATCH+=1)) - ;; - *) - echo "Invalid impact: $impact" >&2 - exit 1 - ;; - esac - - echo "$MAJOR.$MINOR.$PATCH" - } - - commit=$(git rev-parse HEAD) - if git tag --points-at "$commit" | grep -q .; then - echo "Commit already tagged, skipping release" - exit 0 - fi - - TAG_NAME="v$(next_version "${{ inputs.version }}")" - - if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then - echo "Tag $TAG_NAME already exists, refusing to overwrite" >&2 - exit 1 - fi - - if [[ "${{ inputs.dry_run }}" == "true" ]]; then - echo "Dry run: would create tag $TAG_NAME" - exit 0 - fi - - git config user.name github-actions - git config user.email github-actions@github.com - - git tag "$TAG_NAME" - git push origin "$TAG_NAME" |
