Creating a Support Pack: Difference between revisions

From Flashpoint Datahub
Jump to navigation Jump to search
(Created page with "test")
 
No edit summary
Line 1: Line 1:
test
 
== Setting up the Gitlab Repository ==
 
Login to the Flashpoint Gitlab instance. https://gitlab.unstable.life/
 
Create a public Blank Project under the <code>flashpoint/components</code> group.
 
[[File:creating_support_pack_gitlab_1.png]]
 
Clone this new repository locally. Add a <code>.gitlab-ci.yml</code> file to the root of the folder, with the template file below. Replace the <code>COMPONENT_NAME</code>, <code>META_NAME</code> and <code>META_DESCRIPTION</code> variables as appropriate.
 
Whenever you push this repository, Gitlab will automatically pack up any files (excluding files starting with . at the root) into a Flashpoint component, generate the metadata and upload it to the development server.
 
'''.gitlab-ci.yml'''
<code>
variables:
  COMPONENT_NAME: "supportpack-name"
  NEXUS_REPO: "components"
  META_NAME: "Component Name"
  META_DESCRIPTION: "Component Description"
include:
  - project: 'flashpoint/docker/nexus-deploy-action'
    ref: main
    file: '/docker-build.gitlab-ci.yml'
deploy:
  stage: build
  script: |
    COMP_FILE=${COMPONENT_NAME}.zip
    COMP_JSON=${COMPONENT_NAME}.json
    zip -r $COMP_FILE ./ -x "./.**"
    jq --null-input \
        --arg name    "$META_NAME" \
        --arg desc    "$META_DESCRIPTION" \
        --arg date    $(date +%s) \
        --arg download $(du -b $COMP_FILE | awk '{print $1}') \
        --arg install  $(7z l $COMP_FILE | tail -n 1 | awk '{print $3}') \
        --arg path    "FPSoftware" \
        --arg hash    $(crc32 $COMP_FILE) \
        '{
          "title": $name,
          "description": $desc,
          "date-modified": $date,
          "download-size": $download,
          "install-size": $install,
          "path": $path,
          "crc32": $hash
        }' > $COMP_JSON
    zip artifact.zip $COMP_FILE $COMP_JSON
  artifacts:
    paths:
      - artifact.zip
</code>
 
Next we want to make sure all binary files are commited by Git LFS. To automate this we'll let Git keep track of which file extensions to use LFS to commit. There's an example <code>.gitattributes</code> below that you can use as a template. Be sure to add any extra file extensions as is appropriate for your support pack.
 
'''.gitattributes'''
 
<code>
  *.dll filter=lfs diff=lfs merge=lfs -text
  *.ocx filter=lfs diff=lfs merge=lfs -text
  *.mid filter=lfs diff=lfs merge=lfs -text
  *.pwc filter=lfs diff=lfs merge=lfs -text
  *.exe filter=lfs diff=lfs merge=lfs -text
  *.db filter=lfs diff=lfs merge=lfs -text
  *.sqlite filter=lfs diff=lfs merge=lfs -text
</code>
 
=== Adding / Updating Files ===
Add all the files your support pack includes. '''Do not''' include shared dependencies like Browser applications. For examples please see other component repositories on Gitlab.

Revision as of 17:51, 22 February 2023

Setting up the Gitlab Repository

Login to the Flashpoint Gitlab instance. https://gitlab.unstable.life/

Create a public Blank Project under the flashpoint/components group.

Creating support pack gitlab 1.png

Clone this new repository locally. Add a .gitlab-ci.yml file to the root of the folder, with the template file below. Replace the COMPONENT_NAME, META_NAME and META_DESCRIPTION variables as appropriate.

Whenever you push this repository, Gitlab will automatically pack up any files (excluding files starting with . at the root) into a Flashpoint component, generate the metadata and upload it to the development server.

.gitlab-ci.yml

variables:
  COMPONENT_NAME: "supportpack-name"
  NEXUS_REPO: "components"
  META_NAME: "Component Name"
  META_DESCRIPTION: "Component Description"
include:
  - project: 'flashpoint/docker/nexus-deploy-action'
    ref: main
    file: '/docker-build.gitlab-ci.yml'
deploy:
  stage: build
  script: |
    COMP_FILE=${COMPONENT_NAME}.zip
    COMP_JSON=${COMPONENT_NAME}.json
    zip -r $COMP_FILE ./ -x "./.**"
    jq --null-input \
        --arg name     "$META_NAME" \
        --arg desc     "$META_DESCRIPTION" \
        --arg date     $(date +%s) \
        --arg download $(du -b $COMP_FILE | awk '{print $1}') \
        --arg install  $(7z l $COMP_FILE | tail -n 1 | awk '{print $3}') \
        --arg path     "FPSoftware" \
        --arg hash     $(crc32 $COMP_FILE) \
        '{ 
          "title": $name,
          "description": $desc,
          "date-modified": $date,
          "download-size": $download,
          "install-size": $install,
          "path": $path,
          "crc32": $hash 
        }' > $COMP_JSON
    zip artifact.zip $COMP_FILE $COMP_JSON
  artifacts:
    paths:
      - artifact.zip

Next we want to make sure all binary files are commited by Git LFS. To automate this we'll let Git keep track of which file extensions to use LFS to commit. There's an example .gitattributes below that you can use as a template. Be sure to add any extra file extensions as is appropriate for your support pack.

.gitattributes

 *.dll filter=lfs diff=lfs merge=lfs -text
 *.ocx filter=lfs diff=lfs merge=lfs -text
 *.mid filter=lfs diff=lfs merge=lfs -text
 *.pwc filter=lfs diff=lfs merge=lfs -text
 *.exe filter=lfs diff=lfs merge=lfs -text
 *.db filter=lfs diff=lfs merge=lfs -text
 *.sqlite filter=lfs diff=lfs merge=lfs -text

Adding / Updating Files

Add all the files your support pack includes. Do not include shared dependencies like Browser applications. For examples please see other component repositories on Gitlab.