Skip to content

Commit

Permalink
Merge pull request #1 from edenlabllc/feature/FFS-1-code-base-transfer
Browse files Browse the repository at this point in the history
Feature/ffs 1 code base transfer
  • Loading branch information
apanasiuk-el authored May 30, 2024
2 parents 3b3a5d6 + 176cb17 commit dec6b1c
Show file tree
Hide file tree
Showing 32 changed files with 9,750 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release RMK using GoReleaser

on:
push:
branches:
- master
- release/*

permissions:
contents: write

env:
# AWS region of the AWS account storing images in ECR.
CORE_AWS_REGION: eu-north-1

jobs:
goreleaser:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.CORE_AWS_REGION }}
aws-access-key-id: ${{ secrets.RMK_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.RMK_AWS_SECRET_ACCESS_KEY }}

- name: Get and push new tag version
run: |
# constants for selecting branches
readonly GIT_BRANCH="${GITHUB_REF_NAME}"
readonly GITHUB_ORG="${GITHUB_REPOSITORY_OWNER}"
function release() {
echo "Git commit message:"
GIT_COMMIT_MSG="$(git log -1 --pretty=format:"%s")"
echo "${GIT_COMMIT_MSG}"
if [[ ! "${GIT_COMMIT_MSG}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${GITHUB_ORG}/release/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
>&2 echo "Pushes to master should be done via merges of PR requests from release/vN.N.N branches only."
>&2 echo "The expected message format (will be used for parsing a release tag):"
>&2 echo "Merge pull request #N from edenlabllc/release/vN.N.N"
exit 1
fi
VERSION="${BASH_REMATCH[1]}"
echo "DISABLE_BLOB_RMK_RC=true" >> "${GITHUB_ENV}"
}
case "${GIT_BRANCH}" in
release/*)
VERSION="${GIT_BRANCH#release/}-rc"
echo "DISABLE_BLOB_RMK=true" >> "${GITHUB_ENV}"
echo "Release candidate version: ${VERSION}"
git fetch --tags &> /dev/null
if (git tag | grep "${VERSION}" &> /dev/null); then
git tag --delete "${VERSION}"
git push --delete origin "${VERSION}"
fi
;;
master)
release
;;
esac
echo "Configure Git user.name and user.email."
git config user.name github-actions
git config user.email [email protected]
echo "Add Git tag ${VERSION}."
git tag "${VERSION}"
git push origin "${VERSION}" -f
- name: Run GoReleaser artifact build
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.23.0
args: build --clean

- name: Copy metadata RMK release
run: |
cp ./dist/metadata.json ./bin/metadata.json
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.23.0
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.idea/
.deps/
.env
etc/
dist/
metadata.json
138 changes: 138 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
project_name: rmk
release:
disable: false
ids:
- rmk
github:
owner: edenlabllc
name: rmk
name_template: '{{.ProjectName}}-v{{.Version}}'
before:
hooks:
# - go get ./...
- go mod tidy
builds:
- goos:
- linux
- darwin
goarch:
- amd64
gomips:
- hardfloat
targets:
- linux_amd64
- darwin_amd64
dir: .
main: .
ldflags:
- -s -w -X main.version={{.Tag}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
- -X main.timestamp={{.Timestamp}} -X main.name={{.Binary}} -X main.builtBy=goreleaser
- -X main.target={{.Os}}_{{.Arch}}
binary: rmk
env:
- CGO_ENABLED=0
builder: go
gobinary: go
archives:
- id: rmk
format: binary
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
blobs:
- bucket: edenlabllc-rmk
provider: s3
region: eu-north-1
disableSSL: true
folder: '{{ .ProjectName }}/latest-rc'
disable: '{{ envOrDefault "DISABLE_BLOB_RMK_RC" "false" }}'
ids:
- rmk
extra_files:
- glob: ./bin/metadata.json
- bucket: edenlabllc-rmk
provider: s3
region: eu-north-1
disableSSL: true
folder: '{{ .ProjectName }}/latest'
disable: '{{ envOrDefault "DISABLE_BLOB_RMK" "false" }}'
ids:
- rmk
extra_files:
- glob: ./bin/metadata.json
- provider: s3
region: eu-north-1
disableSSL: true
bucket: edenlabllc-rmk
ids:
- rmk
- provider: s3
region: eu-north-1
disableSSL: true
bucket: edenlabllc-rmk
folder: "{{ .ProjectName }}"
ids:
- none
extra_files:
- glob: ./bin/s3-installer
checksum:
name_template: 'checksums.txt'
algorithm: sha256
dist: dist
gomod:
gobinary: go
env:
- GOPROXY=direct
snapshot:
name_template: 'v{{ incpatch .Version }}-next'
source:
enabled: false
changelog:
skip: true
announce:
twitter:
enabled: false
reddit:
enabled: false
slack:
enabled: true
# Message template to use while publishing.
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}`
message_template: |
*Released new version of {{ .ProjectName }}: `{{.Tag}}`*
*Release notes:*
- Code base transferred from private to public GitHub repository.
- Changed S3 bucket name for RMK artifact.
Installation of latest RMK version:
```
curl -sL "https://edenlabllc-rmk.s3.eu-north-1.amazonaws.com/rmk/s3-installer" | bash
rmk --version
```
Installation of specific RMK version:
```
curl -sL "https://edenlabllc-rmk.s3.eu-north-1.amazonaws.com/rmk/s3-installer" | bash -s -- "${RMK_VERSION}"
rmk --version
```
Update to latest RMK version:
```
rmk update
```
Update to the specific RMK version:
```
rmk update --version vX.X.X
```
*Actions required in project repositories after an update:*
```
rmk config init
```
# The name of the channel that the user selected as a destination for webhook messages.
channel: '#fhir-rmk'
# Set your Webhook's username.
username: 'GoReleaser'
# Emoji to use as the icon for this message. Overrides icon_url.
icon_emoji: "package"
discord:
enabled: false
teams:
enabled: false
Loading

0 comments on commit dec6b1c

Please sign in to comment.