Skip to content

Commit e7e54b8

Browse files
committed
Rework GH actions to CD latest, tag on release
1 parent 979a983 commit e7e54b8

File tree

4 files changed

+53
-24
lines changed

4 files changed

+53
-24
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
tags:
8-
- 'v**'
9-
pull_request:
10-
branches:
11-
- master
127

138
jobs:
149
test:
@@ -17,18 +12,6 @@ jobs:
1712
- uses: actions/checkout@v1
1813
- name: Test
1914
run: make test
20-
publish-docs:
21-
needs: [test]
22-
runs-on: ubuntu-latest
23-
steps:
24-
- uses: actions/checkout@v1
25-
- name: Update Docker hub metadata
26-
uses: docker://mpepping/docker-hub-metadata-github-action
27-
env:
28-
IMAGE: ${{ github.repository }}
29-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
30-
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
31-
continue-on-error: true
3215
publish:
3316
needs: [test]
3417
runs-on: ubuntu-latest
@@ -37,8 +20,7 @@ jobs:
3720
- name: Build
3821
shell: bash
3922
run: make build
40-
- name: Publish
41-
if: startsWith(github.ref, 'refs/tags/')
23+
- name: Publish Latest
4224
shell: bash
4325
run: |
4426
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release publishing
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
publish-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Update Docker hub metadata
14+
uses: docker://mpepping/docker-hub-metadata-github-action
15+
env:
16+
IMAGE: rustserverless/lambda-rust
17+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
18+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
19+
continue-on-error: true
20+
publish:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v1
24+
- name: Build
25+
shell: bash
26+
run: make build
27+
- name: Publish
28+
shell: bash
29+
with:
30+
release_tag: ${{ github.event.release.tag_name }}
31+
run: |
32+
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
33+
make publish-tag

.github/workflows/untrusted.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Untrusted workflows (PRs)
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Test
14+
run: make test

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
DOCKER ?= docker
2-
VERSION ?= 0.4.0
32
RUST_VERSION ?= 1.54.0
43
REPO ?= rustserverless/lambda-rust
5-
TAG ?= "$(REPO):$(VERSION)-rust-$(RUST_VERSION)"
64

75
publish: build
8-
$(DOCKER) push $(TAG)
96
$(DOCKER) push $(REPO):latest
107

8+
publish-tag: build publish
9+
$(DOCKER) tag $(REPO):latest "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)"
10+
$(DOCKER) push "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)"
11+
1112
build:
12-
$(DOCKER) build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(TAG) .
13-
$(DOCKER) tag $(TAG) $(REPO):latest
13+
$(DOCKER) build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(REPO):latest .
1414

1515
test:
1616
@tests/test.sh

0 commit comments

Comments
 (0)