Skip to content

Commit 222d7e7

Browse files
authoredSep 18, 2021
Release Docker image as part of "Release" GitHub Action (loic-sharma#683)
1 parent 49bf777 commit 222d7e7

File tree

2 files changed

+59
-35
lines changed

2 files changed

+59
-35
lines changed
 

‎.github/workflows/publish.yml

-35
This file was deleted.

‎.github/workflows/release.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
description: 'Release version'
8+
required: true
9+
default: '1.0.0-preview1'
10+
packageSource:
11+
description: 'Package source'
12+
required: true
13+
default: 'https://api.nuget.org/v3/index.json'
14+
15+
jobs:
16+
release_packages:
17+
name: Release packages to nuget.org
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v1
25+
with:
26+
dotnet-version: 3.1.x
27+
28+
- name: Restore dependencies
29+
run: dotnet restore
30+
- name: Build
31+
run: dotnet build --no-restore
32+
- name: Test
33+
run: dotnet test --no-build --verbosity normal
34+
- name: Pack
35+
run: dotnet pack --configuration Release -p:PackageVersion=${{ github.event.inputs.releaseVersion }} --output artifacts
36+
- name: Push
37+
run: dotnet nuget push artifacts/*.nupkg -s ${{ github.event.inputs.packageSource }} -k ${{secrets.NUGET_API_KEY}}
38+
39+
release_docker_image:
40+
name: Release Docker image to Docker Hub
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- uses: actions/checkout@v2
45+
46+
- name: Log in to Docker Hub
47+
uses: docker/login-action@v1
48+
with:
49+
username: ${{ secrets.DOCKER_USERNAME }}
50+
password: ${{ secrets.DOCKER_PASSWORD }}
51+
52+
- name: Build and push Docker image
53+
uses: docker/build-push-action@v2
54+
with:
55+
context: .
56+
push: true
57+
tags: |
58+
loicsharma/baget:latest
59+
loicsharma/baget:${{ github.event.inputs.releaseVersion }}

0 commit comments

Comments
 (0)
Please sign in to comment.