diff --git a/.github/workflows/regular-tests.yaml b/.github/workflows/regular-tests.yaml index fbcfb625..580dee9d 100644 --- a/.github/workflows/regular-tests.yaml +++ b/.github/workflows/regular-tests.yaml @@ -1,4 +1,4 @@ -name: dev tests +name: regular tests on: push: diff --git a/.github/workflows/release_beta.yaml b/.github/workflows/release_beta.yaml new file mode 100644 index 00000000..07a7afbb --- /dev/null +++ b/.github/workflows/release_beta.yaml @@ -0,0 +1,81 @@ +name: beta release + +on: + push: + branches: + - "beta/v[0-9]+.[0-9]+.[0-9]+" + +permissions: + contents: write + +jobs: + create_release_tag: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT }} + - name: Extract branch name + shell: bash + run: | + original_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + echo "branch_name=$transformed_branch" >> $GITHUB_OUTPUT + tag_name=$(echo "$original_branch" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')-beta + echo "tag_name=$tag_name" >> $GITHUB_OUTPUT + id: extract_branch + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + target_commitish: ${{ steps.extract_branch.outputs.branch_name }} + token: ${{ secrets.PAT }} + tag_name: ${{ steps.extract_branch.outputs.tag_name }} + prerelease: false # change this to false when stable gets released + make_latest: true # change this to false when stable gets released + draft: false + generate_release_notes: true + name: ${{ steps.extract_branch.outputs.tag_name }} + + push_release_to_registry: + name: Push release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: gtstef/filebrowser + - name: Strip v from version number + id: modify-json + run: | + JSON="${{ steps.meta.outputs.tags }}" + # Use jq to remove 'v' from the version field + JSON=$(echo "$JSON" | sed 's/filebrowser:beta\/v/filebrowser:beta_v/') + echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 + file: ./Dockerfile + push: true + tags: ${{ steps.modify-json.outputs.cleaned_tag }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release_dev.yaml b/.github/workflows/release_dev.yaml index c965d5b5..a9e36f39 100644 --- a/.github/workflows/release_dev.yaml +++ b/.github/workflows/release_dev.yaml @@ -3,7 +3,7 @@ name: dev release on: push: branches: - - "dev_v[0-9]+.[0-9]+.[0-9]+" + - "dev/v[0-9]+.[0-9]+.[0-9]+" permissions: contents: write @@ -34,7 +34,7 @@ jobs: run: | JSON="${{ steps.meta.outputs.tags }}" # Use jq to remove 'v' from the version field - JSON=$(echo "$JSON" | sed 's/filebrowser:v/filebrowser:/') + JSON=$(echo "$JSON" | sed 's/filebrowser:dev\/v/filebrowser:dev_v/') echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT - name: Build and push uses: docker/build-push-action@v6 diff --git a/.github/workflows/release_stable.yaml b/.github/workflows/release_stable.yaml new file mode 100644 index 00000000..7d989f9f --- /dev/null +++ b/.github/workflows/release_stable.yaml @@ -0,0 +1,80 @@ +name: stable release + +on: + push: + branches: + - "stable/v[0-9]+.[0-9]+.[0-9]+" + +permissions: + contents: write + +jobs: + create_release_tag: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT }} + - name: Extract branch name + shell: bash + run: | + original_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + echo "branch_name=$transformed_branch" >> $GITHUB_OUTPUT + tag_name=$(echo "$original_branch" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')-stable + echo "tag_name=$tag_name" >> $GITHUB_OUTPUT + id: extract_branch + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + target_commitish: ${{ steps.extract_branch.outputs.branch_name }} + token: ${{ secrets.PAT }} + tag_name: ${{ steps.extract_branch.outputs.tag_name }} + prerelease: false + draft: false + generate_release_notes: true + name: ${{ steps.extract_branch.outputs.tag_name }} + + push_release_to_registry: + name: Push release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: gtstef/filebrowser + - name: Strip v from version number + id: modify-json + run: | + JSON="${{ steps.meta.outputs.tags }}" + # Use jq to remove 'v' from the version field + JSON=$(echo "$JSON" | sed 's/filebrowser:stable\/v/filebrowser:/') + echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 + file: ./Dockerfile + push: true + tags: ${{ steps.modify-json.outputs.cleaned_tag }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index ee1588ef..21cec5a9 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -1,9 +1,9 @@ -name: tag +name: tag update on: push: tags: - - "v*" + - "v[0-9]+.[0-9]+.[0-9]+.*" permissions: contents: write