-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (55 loc) · 2.17 KB
/
build_container.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build shiny Docker image and generate Galaxy wrapper
on:
workflow_dispatch: {}
push: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract metadata for container image
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value={{branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push container image to ghcr
uses: docker/build-push-action@v4
with:
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
- name: Set variables
id: vars
run: |
echo "container=${{ steps.meta.outputs.tags }}" >> $GITHUB_OUTPUT
echo "source=https://github.com/${{github.repository}}" >> $GITHUB_OUTPUT
NAME="$(echo '${{github.repository}}' | awk -F'/' '{print $2}')"
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "id=$(echo $NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Generate wrapper
run: |
cp .github/scripts/galaxy-wrapper-template.xml galaxy-wrapper.xml
sed -i 's#{{{CONTAINER}}}#${{steps.vars.outputs.container}}#g' galaxy-wrapper.xml
sed -i 's#{{{SOURCE}}}#${{steps.vars.outputs.source}}#g' galaxy-wrapper.xml
sed -i 's#{{{NAME}}}#${{steps.vars.outputs.name}}#g' galaxy-wrapper.xml
sed -i 's#{{{ID}}}#${{steps.vars.outputs.id}}#g' galaxy-wrapper.xml
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.name github-actions
git config user.email [email protected]
git add galaxy-wrapper.xml
git commit -m "Update Galaxy Wrapper $(TZ=EST date '+%Y-%m-%d_%H-%M')"
git push