Skip to content

Commit 67318f5

Browse files
committed
Improving Github Actions pipeline (and adding release assets)
1 parent 7f8e30f commit 67318f5

File tree

7 files changed

+141
-30
lines changed

7 files changed

+141
-30
lines changed

.github/workflows/build_pipeline.yml

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: EC2Cryptomatic build and deployment
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
9+
code_linting:
10+
runs-on: ubuntu-latest
11+
container:
12+
image: cytopia/golint:latest
13+
volumes:
14+
- /__w/ec2cryptomatic/ec2cryptomatic:/data
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Starting code linting
19+
run: golint .
20+
21+
22+
code_testing:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
with:
27+
# Disabling shallow clone is recommended for improving relevancy of reporting
28+
fetch-depth: 0
29+
30+
- name: Setup Golang
31+
uses: actions/setup-go@v2
32+
with:
33+
go-version: '^1.14' # The Go version to download (if necessary) and use.
34+
35+
- name: Run Golang test
36+
run: go test .
37+
38+
- name: SonarCloud Scan
39+
uses: sonarsource/sonarcloud-github-action@master
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
44+
- name: Create Docker image file
45+
run: docker build .
46+
47+
48+
code_compiling:
49+
needs: [code_linting, code_testing]
50+
runs-on: ubuntu-latest
51+
strategy:
52+
matrix:
53+
os: [linux, windows, freebsd]
54+
arch: [amd64, arm]
55+
exclude:
56+
- os: windows
57+
arch: arm
58+
fail-fast: true
59+
60+
steps:
61+
- uses: actions/checkout@v2
62+
63+
- name: Setup Golang
64+
uses: actions/setup-go@v2
65+
with:
66+
go-version: '^1.14' # The Go version to download (if necessary) and use.
67+
68+
- run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o ec2cryptomatic
69+
70+
- name: Package artefacts
71+
run: zip ec2cryptomatic.${{ matrix.os }}.${{ matrix.arch }}.zip ec2cryptomatic
72+
73+
- uses: actions/upload-artifact@v2
74+
with:
75+
path: ec2cryptomatic.${{ matrix.os }}.${{ matrix.arch }}.zip
76+
77+
78+
code_deploying:
79+
needs: [code_linting, code_testing, code_compiling]
80+
runs-on: ubuntu-latest
81+
if: github.ref == 'refs/heads/master'
82+
steps:
83+
- uses: actions/checkout@v2
84+
- name: Set VERSION variable
85+
id: vars
86+
run: echo ::set-output name=tag_version::"$(head -1 VERSION)"
87+
88+
- name: Download artefacts before uploading
89+
uses: actions/download-artifact@v2
90+
91+
- name: Create a new release
92+
id: create_release
93+
uses: actions/create-release@v1
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
with:
97+
tag_name: ${{ steps.vars.outputs.tag_version }}
98+
release_name: Release ${{ steps.vars.outputs.tag_version }}
99+
draft: false
100+
prerelease: false
101+
102+
- name: Upload Release Assets
103+
id: upload-release-assets
104+
uses: dwenegar/upload-release-assets@v1
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
release_id: ${{ steps.create_release.outputs.id }}
109+
assets_path: artifact/
110+
111+
- name: Publish image to Docker Hub Registry
112+
uses: elgohr/[email protected]
113+
with:
114+
name: jbrt/ec2cryptomatic
115+
username: ${{ secrets.DOCKER_USERNAME }}
116+
password: ${{ secrets.DOCKER_PASSWORD }}
117+
dockerfile: Dockerfile
118+
tags: "latest,${{ steps.vars.outputs.tag_version }}"
119+

.github/workflows/docker.yml

-29
This file was deleted.

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.2.4
4+
5+
- Improving Github Actions pipeline
6+
37
## 2.1.1
48

59
- Update SSL/TLS certificates into Docker image

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Github Action](https://github.com/jbrt/ec2cryptomatic/workflows/publish-docker-image/badge.svg)](https://github.com/jbrt/ec2cryptomatic/actions?workflow=publish-docker-image)
44
![Docker Pulls](https://img.shields.io/docker/pulls/jbrt/ec2cryptomatic.svg?label=pulls&logo=docker)
5+
[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=jbrt_ec2cryptomatic)](https://sonarcloud.io/dashboard?id=jbrt_ec2cryptomatic)
56

67
Encrypt EBS volumes from AWS EC2 instances
78

@@ -100,6 +101,15 @@ Or you can use the image already pulled into the official Docker Hub:
100101

101102
`docker pull jbrt/ec2cryptomatic`
102103

104+
## Binaries
105+
106+
If you do not want to use Docker, you can use a binary version (accessible from the release section).
107+
Versions currently supported:
108+
109+
- Linux (x86_64, ARM)
110+
- FreeBSD (x86_64, ARM)
111+
- Windows (x86_64 only)
112+
103113
## Example
104114

105115
![example](ec2cryptomatic.png)

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.2.4

constants/constants.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package constants
22

33
const (
44
// VERSION is the overall version of the program
5-
VERSION string = "2.1.0"
5+
VERSION string = "2.2.4"
66
// VolumeMaxAttempts how many attempts EC2 EBS waiters will used between SDK actions (snapshot ebsvolume)
77
VolumeMaxAttempts int = 10000
88
// InstanceMaxAttempts how many attempts EC2 waiters will used between SDK actions (attach/detach ebsvolume)

sonar-project.properties

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sonar.organization=jbrt
2+
sonar.projectKey=jbrt_ec2cryptomatic
3+
4+
# relative paths to source directories. More details and properties are described
5+
# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/
6+
sonar.sources=.

0 commit comments

Comments
 (0)