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

chore: Automatically build and release a new version #5

Merged
merged 5 commits into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 5 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
audiotheker
build/
LICENSE
README.md
Dockerfile
CHANGELOG.md
Dockerfile.*
Makefile
.gitignore
.dockerignore
.dockerignore
.github/
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release

on:
push:
tags:
- '*'

jobs:
release:
name: Build and release new version
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build for macOS, Windows, Linux
run: make release-darwin && make release-windows && make release-darwin
- name: Create GitHub release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ github.ref_name }}
tag_name: ${{ github.ref }}
body: HERE BE COOL CHANGELOG
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Add Linux build to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/audiotheker.linux-amd64.tar.gz
asset_name: audiotheker.linux-amd64.tar.gz
asset_content_type: application/gzip
- name: Add macOS build to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/audiotheker.darwin-amd64.tar.gz
asset_name: audiotheker.darwin-amd64.tar.gz
asset_content_type: application/gzip
- name: Add Windows build to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/audiotheker.windows-amd64.zip
asset_name: audiotheker.windows-amd64.zip
asset_content_type: application/zip
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
go.work

# audiotheker binary
audiotheker
build/

# macOS specific files
.DS_Store
.DS_Store
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.0] - 2023-01-13

### Added
* Feature: Support downloading collections and individual episodes

## Fixed
* Fix Docker example in `README` (thanks @endresjo)
* Add missing newline when printing errors

## [0.1.0] - 2023-01-08

Initial release
31 changes: 28 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
GOFMT_FILES?=$$(find . -not -path "./vendor/*" -type f -name '*.go')

BUILD_DIR=./build
BIN_NAME=audiotheker

default: run

bin: fmtcheck
CGO_ENABLED=0 go build -o audiotheker -ldflags="-s -w" main.go
release-linux: fmtcheck build-setup bin-linux
tar -czvf $(BUILD_DIR)/$(BIN_NAME).linux-amd64.tar.gz $(BUILD_DIR)/$(BIN_NAME);

release-darwin: fmtcheck build-setup bin-darwin
tar -czvf $(BUILD_DIR)/$(BIN_NAME).darwin-amd64.tar.gz $(BUILD_DIR)/$(BIN_NAME);

release-windows: fmtcheck build-setup bin-windows
zip -9 -y $(BUILD_DIR)/$(BIN_NAME).windows-amd64.zip $(BUILD_DIR)/$(BIN_NAME).exe;

bin-linux: fmtcheck build-setup
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o $(BUILD_DIR)/$(BIN_NAME) -ldflags="-s -w" main.go

bin-darwin: fmtcheck build-setup
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o $(BUILD_DIR)/$(BIN_NAME) -ldflags="-s -w" main.go

bin-windows: fmtcheck build-setup
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o $(BUILD_DIR)/$(BIN_NAME).exe -ldflags="-s -w" main.go

bin: fmtcheck build-setup
CGO_ENABLED=0 go build -o $(BUILD_DIR)/audiotheker -ldflags="-s -w" main.go

build-setup:
mkdir -p $(BUILD_DIR)

fmt:
gofmt -w $(GOFMT_FILES)
Expand All @@ -14,4 +38,5 @@ fmtcheck:
run: bin
./audiotheker

.PHONY: bin fmt fmtcheck run default

.PHONY: bin bin-windows bin-darwin bin-linux fmt fmtcheck run default
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Copy the URL to a program, collection, or an individual episode from your browse
### Built binary

```sh
$ ./audiotheker download \
$ ./build/audiotheker download \
"https://www.ardaudiothek.de/sendung/j-r-r-tolkien-der-herr-der-ringe-fantasy-hoerspiel-klassiker/12197351/" \
PATH/TO/YOUR/DOWNLOADS
```
Expand All @@ -93,7 +93,7 @@ $ docker run \
--rm \
--user $(id -u):$(id -g) \
-v PATH/TO/YOUR/DOWNLOADS:/download \
audiotheker:0.1.0 download \
audiotheker:0.2.0 download \
"https://www.ardaudiothek.de/sendung/j-r-r-tolkien-der-herr-der-ringe-fantasy-hoerspiel-klassiker/12197351/" \
/download
```
Expand Down