Skip to content

Commit

Permalink
add docker ; update go version and update install way
Browse files Browse the repository at this point in the history
  • Loading branch information
cxjava committed Jan 10, 2024
1 parent af014e2 commit c47df7e
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 425 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "daily"
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: stable
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: stable
- name: Bump tag version
id: bumpTag
uses: anothrNick/[email protected]
Expand All @@ -33,11 +33,19 @@ jobs:
run: |
echo "GOLANG_VERSION=$(go version)" >> $GITHUB_ENV
echo "BUILT_BY=$(whoami)@$(hostname)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOLANG_VERSION: ${{ env.GOLANG_VERSION }}
Expand Down
74 changes: 49 additions & 25 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
version: 1
before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
Expand All @@ -12,40 +14,62 @@ builds:
- -X 'github.com/{{.Env.GITHUB_REPOSITORY}}/cmd.BuildDate={{.Date}}'
- -X 'github.com/{{.Env.GITHUB_REPOSITORY}}/cmd.BuiltWithGoVersion={{.Env.GOLANG_VERSION}}'
- -X 'github.com/{{.Env.GITHUB_REPOSITORY}}/cmd.BuiltBy={{.Env.BUILT_BY}}'
targets:
- darwin_amd64
- darwin_arm64
- linux_386
- linux_amd64
- linux_amd64_v3
- linux_arm_5
- linux_arm_6
- linux_arm_7
- linux_arm64
# - linux_mips_softfloat
# - linux_mips_hardfloat
# - linux_mipsle_softfloat
# - linux_mipsle_hardfloat
# - linux_mips64
# - linux_mips64le
# - linux_s390x
# - linux_riscv64
# - freebsd_386
# - freebsd_amd64
- windows_386
- windows_amd64
- windows_amd64_v3
- windows_arm64
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64

archives:
- wrap_in_directory: false
format: tar.gz
format_overrides:
- goos: windows
format: zip

checksum:
name_template: "checksums.txt"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

release:
draft: true
prerelease: auto
name_template: "{{.ProjectName}}-v{{.Version}}-{{.Date}}"
name_template: "{{.ProjectName}}-v{{.Version}}-{{.Date}}"

dockers:
- use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile
image_templates:
- "ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/cxjava/{{ .ProjectName }}:latest-amd64"
build_flag_templates:
- --platform=linux/amd64
- use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile
image_templates:
- "ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "ghcr.io/cxjava/{{ .ProjectName }}:latest-arm64v8"
build_flag_templates:
- --platform=linux/arm64/v8

docker_manifests:
- name_template: ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}
image_templates:
- ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}-amd64
- ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}-arm64v8
- name_template: ghcr.io/cxjava/{{ .ProjectName }}:latest
image_templates:
- ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}-amd64
- ghcr.io/cxjava/{{ .ProjectName }}:{{ .Version }}-arm64v8
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
WORKDIR /
COPY m3u8-downloader /
USER 65534
ENTRYPOINT ["/m3u8-downloader"]
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,29 @@ m3u8 downloader by Golang
- [ ] Delete error CDN IP


## Installation
# Installation

### Linux / macOS
* install from [jpillora/installer](https://github.com/jpillora/installer)

This [godownloader](https://github.com/kamilsk/godownloader) script will query GitHub for the latest release and download the correct binary for your platform into the directory set with the `-b` flag.
```sh
#install to /usr/local/bin
curl https://i.jpillora.com/cxjava/m3u8-downloader! | bash
# or
curl https://gobin.fly.dev/cxjava/m3u8-downloader! | bash
```

## Via [goblin.run](https://goblin.run)

#### System-wide Install
```shell
# binary will be /usr/local/bin/m3u8-downloader
curl -sSfL https://goblin.run/github.com/cxjava/m3u8-downloader | sh

```bash
wget -O - https://raw.githubusercontent.com/cxjava/m3u8-downloader/main/install.sh | sh -s -- -b /usr/local/bin
# to put to a custom path
curl -sSfL https://goblin.run/github.com/cxjava/m3u8-downloader | PREFIX=/tmp sh
```



## Ping command

``` shell
Expand Down
Loading

0 comments on commit c47df7e

Please sign in to comment.