Automatically pull tags on Drone #6

Merged
cadey merged 1 commits from fetch-tags into master 2020-06-12 12:20:15 +00:00
6 changed files with 12 additions and 18 deletions

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
## 0.3.2
Automagically fetch tags when running as a drone plugin.
## 0.3.1
Hotfix in json parsing

2
Cargo.lock generated
View File

@ -326,7 +326,7 @@ dependencies = [
[[package]]
name = "gitea-release"
version = "0.3.1"
version = "0.3.2"
dependencies = [
"anyhow",
"byte-unit",

View File

@ -1,6 +1,6 @@
[package]
name = "gitea-release"
version = "0.3.1"
version = "0.3.2"
authors = ["Christine Dodrill <me@christine.website>"]
edition = "2018"

View File

@ -30,7 +30,7 @@ To use this as a drone plugin, add the following to your `.drone.yml` under the
```yaml
- name: auto-release
image: xena/gitea-release:0.3.1
image: xena/gitea-release:0.3.2
settings:
auth_username: cadey
changelog_path: ./CHANGELOG.md
@ -47,25 +47,13 @@ To use this as a drone plugin, add the following to your `.drone.yml` under the
Replace the values of the settings as makes sense for your gitea server. The
`changelog_path` attribute is optional, and will be `./CHANGELOG.md` by default.
Note that Drone doesn't clone git tags by default. You will need to add a
tag-fetching step to your Drone config until
[#4](https://tulpa.dev/cadey/gitea-release/issues/4) is fixed. You can do that
by adding this before your auto-release step:
```
- name: fetch tags
image: alpine/git
commands:
- git fetch --tags
```
The default branch will automatically be derived from the Gitea API. If you need
to hard-code your default branch name for some reason, add the `default_branch`
setting like this:
```yaml
- name: auto-release
image: xena/gitea-release:0.3.1
image: xena/gitea-release:0.3.2
settings:
auth_username: cadey
default_branch: trunk

View File

@ -1 +1 @@
0.3.1
0.3.2

View File

@ -25,7 +25,9 @@ pub(crate) async fn run(env: DroneEnv) -> Result<()> {
u.set_username(&env.auth_user).unwrap();
u.set_password(Some(&env.token)).unwrap();
repo.remote_delete("origin")?;
repo.remote("origin", u.as_str())?;
let mut origin = repo.remote("origin", u.as_str())?;
origin.connect(git2::Direction::Fetch)?;
origin.fetch(&["refs/tags/*:refs/tags/*"], None, None)?;
release::run(
common,